-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
Ensure Next.js is correctly respecting NODE_ENV
#19046
Comments
This PR fixes a bug where `next/babel` would accidentally enable development transforms for a production build (`next build`). --- Fixes vercel#18929 Fixes vercel#19001 x-ref vercel#19046
This PR fixes a bug where `next/babel` would accidentally enable development transforms for a production build (`next build`). --- Fixes vercel#18929 Fixes vercel#19001 x-ref vercel#19046
This PR fixes a bug where `next/babel` would accidentally enable development transforms for a production build (`next build`). --- Fixes vercel#18929 Fixes vercel#19001 x-ref vercel#19046
This PR fixes a bug where `next/babel` would accidentally enable development transforms for a production build (`next build`). This is tested by the two updated unit tests (which removed a workaround for this bug, and one now properly enables dev transforms). --- Fixes #18929 Fixes #19001 x-ref #19046 x-ref #17032
I believe we should add an alternate way to specify which env files should be loaded, like this:
|
@flybayer that would solve my exact frustration. Our application doesn't care about the |
…d be loaded attempts to partially solve vercel#19046 (.env file loading)
Here's a quick and dirty that should allow for |
@Timer @flybayer @timneutkens thoughts on allowing user to determine which .env override file is loaded? Thoughts on env variable name |
@curiousercreative I've recently opened an extensive RFC here: #25764 |
I just tried This magic build into nextjs is incredibly frustration and a terrible user experience. |
This comment has been minimized.
This comment has been minimized.
Looks like this is still open, and still an issue, causes Error: should not be imported outside of pages/_document. |
This comment was marked as spam.
This comment was marked as spam.
does it work when you set it to production? |
I also get this error, only when setting |
I solve this problem by add a
|
Next.js should unconditionally use
NODE_ENV=development
andNODE_ENV=production
fornext dev
andnext build
respectively in the following areas:.env.*
loadingnext/babel
plugin internal 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 innext.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:
The text was updated successfully, but these errors were encountered: