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

Specify node_env before running build web #1755

Merged
merged 3 commits into from
Feb 9, 2021

Conversation

dac09
Copy link
Collaborator

@dac09 dac09 commented Feb 8, 2021

Small change to make sure all downstream loaders/plugins for webpack receive NODE_ENV as production when running yarn rw build web

This takes care of a lot of weird issues that arise, such as Tailwind not minifying (unless you're lucky, and your build environment has NODE_ENV production by default).

@dac09 dac09 added this to the v0.26.0 milestone Feb 8, 2021
@dac09 dac09 requested a review from peterp February 8, 2021 15:53
@github-actions
Copy link

github-actions bot commented Feb 8, 2021

@dac09 dac09 modified the milestones: v0.26.0, v0.25.0 Feb 9, 2021
@dac09 dac09 modified the milestones: v0.26.0, v0.25.0 Feb 9, 2021
@dac09
Copy link
Collaborator Author

dac09 commented Feb 9, 2021

I know I blocked merging this, but I have to resolve conflicts in build.js anyway. Gonna merge!

@dac09 dac09 merged commit 6437cde into redwoodjs:main Feb 9, 2021
@dac09 dac09 deleted the feature/build-web-env branch February 9, 2021 15:18
@razzeee
Copy link
Contributor

razzeee commented Feb 24, 2023

Would this explain, why accessing NODE_ENV on a deployed server always seems to return production instead of what we've set in NODE_ENV, or should that still be loaded from env when we run yarn rw serve?

https://redwoodjs.com/docs/environment-variables#where-does-redwood-load-my-environment-variables isn't very clear if it really applies to all yarn rw commands I think.

@dac09
Copy link
Collaborator Author

dac09 commented Feb 27, 2023

Would this explain, why accessing NODE_ENV on a deployed server always seems to return production instead of what we've set in NODE_ENV, or should that still be loaded from env when we run yarn rw serve?

Correct - NODE_ENV will always be overridden to production when you build and serve.

@razzeee
Copy link
Contributor

razzeee commented Feb 27, 2023

might be worth documenting on the env var docs

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

Successfully merging this pull request may close these issues.

None yet

3 participants