-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Open
Labels
WebpackRelated to Webpack with Next.js.Related to Webpack with Next.js.bugIssue was opened via the bug report template.Issue was opened via the bug report template.
Description
Next.js should unconditionally use NODE_ENV=development and NODE_ENV=production for next dev and next build respectively in the following areas:
-
.env.*loading - Client-side bundle inlining
- Server-render time
-
next/babelplugin internal mode (fix(next/babel): read env from caller, not process #20679) - Webpack mode (fix(next/babel): read env from caller, not process #20679)
The only way to read a "misconfigured" NODE_ENV (e.g. NODE_ENV=staging) should be in next.config.js. This is only allowed for backwards compatibility.
I believe we also have to allow it to override what Babel "env" is loaded. I don't feel strongly about this.
Next 11 should disallow all non-standard values for this and immediately exit. This behavior should be implemented by whatever PR closes this behind a future flag.
We also need to fix this message:
warn - You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://err.sh/next.js/non-standard-node-env
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
WebpackRelated to Webpack with Next.js.Related to Webpack with Next.js.bugIssue was opened via the bug report template.Issue was opened via the bug report template.