Skip to content
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

Make nuxi prepare run with NODE_ENV set to "development" by default #460

Open
wokalek opened this issue Aug 22, 2024 · 0 comments
Open

Make nuxi prepare run with NODE_ENV set to "development" by default #460

wokalek opened this issue Aug 22, 2024 · 0 comments

Comments

@wokalek
Copy link

wokalek commented Aug 22, 2024

Why was the default mode set to production when running from the command line without setting the NODE_ENV env variable?

I'm talking about this line in the command:

process.env.NODE_ENV = process.env.NODE_ENV || 'production'

Typically, in nuxt.config.ts you might have logic like this:

if (process.env.NODE_ENV === 'development') {
    config.modules?.push('@nuxt/eslint')
}

I need this to avoid installing the @nuxt/eslint module when installing dependencies without development dependencies with pnpm install --prod on the production server, because otherwise I get an error if I just specify the @nuxt/eslint module in the modules section. I need this condition for that.

However, this condition does not work because I simply run pnpm postinstall, process.env.NODE_ENV is set to production and as a result the ./.nuxt/eslint.config.mjs file is not created for the module @nuxt/eslint to work. There may be other things for development that don't work with other modules or don't generate types.

Besides, the .nuxt folder is needed exclusively for development, not for the production build. So why is it set to production by default, and not development?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant