feat(defineConfig): enable conditional return#979
Conversation
PR Summary
|
✅ Deploy Preview for nuxt-tailwindcss ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
| const _defineConfig = createDefineConfig<Partial<Config>>() | ||
| export const defineConfig: typeof _defineConfig = (config) => { | ||
| const isNuxt = !!tryUseNuxt() | ||
| return isNuxt ? config : isMainFile ? requireModule('.nuxt/tailwind/postcss.mjs') : config |
There was a problem hiding this comment.
Could I get a review here possibly?
The use-case is for IntelliSense - if it is used in Nuxt build-time, just return the defined config.
If it is being loaded from the IntelliSense plugin, return .nuxt/tailwind/postcss.mjs contents which will in-turn re-import this file/config, so if it is being imported from there, return the object instead of trying to re-require postcss.mjs causing a cyclic import.
Quite fragile stuff, but I'm thinking I could ship it and based on feedback, remove it if not helpful as it is a non-app functionality feature/change.
…to define-config
|
stupid stuff, the intellisense plugins don't run the config but jiti-import it. need to check for that instead and will reopen when I have something |
| "@nuxtjs/tailwindcss": "link:.", | ||
| "@nuxt/ui": "npm:@nuxt/ui-edge" | ||
| "@nuxt/ui": "npm:@nuxt/ui-edge", | ||
| "unicorn-magic": "0.2.0" |
There was a problem hiding this comment.
Hi @ineshbose, do you happen to have more info on why this resolution is necessary? I noticed after updating to 6.14.0 that the docker builds for our app broke, but adding this resolution to our package.json fixed things. But that was just a random troubleshooting step, and I'd be curious about the root cause.
There was a problem hiding this comment.
Hey - yes it is an odd issue. You can do down this thread to investigate #954, but even I would be slightly confused 😅
resolves #842