-
Notifications
You must be signed in to change notification settings - Fork 196
feat(defineConfig): enable conditional return #979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,16 @@ | ||
| import { fileURLToPath } from 'node:url' | ||
| import { resolve } from 'pathe' | ||
| import { createDefineConfig } from 'c12' | ||
| import { tryUseNuxt, requireModule } from '@nuxt/kit' | ||
| import type { Config } from 'tailwindcss' | ||
|
|
||
| export const defineConfig = createDefineConfig<Partial<Config>>() | ||
| const pathToThisFile = resolve(fileURLToPath(import.meta.url)) | ||
| const pathPassedToNode = resolve(process.argv[1]) | ||
| const isMainFile = pathToThisFile.includes(pathPassedToNode) | ||
|
|
||
| const _defineConfig = createDefineConfig<Partial<Config>>() | ||
| export const defineConfig: typeof _defineConfig = (config) => { | ||
| const isNuxt = !!tryUseNuxt() | ||
| return isNuxt ? config : isMainFile ? requireModule('.nuxt/tailwind/postcss.mjs') : config | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 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. |
||
| } | ||
| export default defineConfig | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - yes it is an odd issue. You can do down this thread to investigate #954, but even I would be slightly confused 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!