tailwindlabs/tailwindcss-intellisense#663 (comment)
It is bug on module side
I'm sorry, I looked into module code, and saw that it is problem on @tailwindlabs side with resolveConfig.js
file
But as a temporary workaround we can do this (at https://github.com/nuxt-modules/tailwindcss/blob/main/src/module.ts#L142-L148):
const resolveConfig: any = await import('tailwindcss/resolveConfig.js').then(r => r.default || r)
const resolvedConfig = resolveConfig(tailwindConfig)
resolvedConfig.plugins = []
addTemplate({
filename: 'tailwind.config.cjs',
getContents: () => `module.exports = ${JSON.stringify(resolvedConfig, null, 2)}`,
write: true
})
The current fix solves the base resolved configuration, but it does not handle plugins from Tailwind Presets.
Reproduction: https://stackblitz.com/edit/nuxt-starter-afebar
I believe we could expand upon the fix like this:
const resolveConfig: any = await import("tailwindcss/resolveConfig.js").then((r) => r.default || r)
const resolvedConfig = resolveConfig(tailwindConfig)
resolvedConfig.plugins = []
for (const preset of resolvedConfig.presets) {
if(preset.plugins != null) {
preset.plugins = []
}
}
addTemplate({
filename: "tailwind.config.cjs",
getContents: () => `module.exports = ${JSON.stringify(resolvedConfig, null, 2)}`,
write: true,
})
Can I open a PR to add this?
This problem also occurs for me when using purge.options.safelist
or just safelist
in the root of the tailwind config. If i remove any of these properties, the intellisense starts working again.
tailwind.config.js:
export default {
purge: {
options: {
safelist: [
{ pattern: /(bg|text)-./ },
],
},
},
}
tailwind.config.cjs:
module.exports = {
'purge': {
'options': {
'safelist': [
{
'pattern': {},
},
],
},
},
'safelist': [
{
'pattern': {},
},
],
};
tailwind.config.js:
export default {
safelist: [
{ pattern: /(bg|text)-./ },
],
}
tailwind.config.cjs:
module.exports = {
"safelist": [
{
"pattern": {}
}
],
}
Owner Name | nuxt-modules |
Repo Name | tailwindcss |
Full Name | nuxt-modules/tailwindcss |
Language | TypeScript |
Created Date | 2019-04-04 |
Updated Date | 2023-03-29 |
Star Count | 1285 |
Watcher Count | 12 |
Fork Count | 157 |
Issue Count | 57 |
Issue Title | Created Date | Updated Date |
---|