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

Don't set NODE_ENV in assets.rake #1356

Merged
merged 1 commit into from
Feb 26, 2021
Merged

Conversation

justin808
Copy link
Member

@justin808 justin808 commented Feb 17, 2021

Setting NODE_ENV here interferes with Rails'/webpacker's control of this
variable, particularly in production. In particular, this means that
compiling assets in production using
bundle exec rails assets:precompile uses the development webpacker
configuration rather than the production one.

  1. NODE_ENV is not set when running precompile
  2. React on Rails sees it's empty and sets to development
  3. rails/webpacker does not apply default of production

This change is Reviewable

Setting NODE_ENV here interferes with Rails'/webpacker's control of this
variable, particularly in production. In particular, this means that
compiling assets in production using
`bundle exec rails assets:precompile` uses the development webpacker
configuration rather than the production one.
@justin808
Copy link
Member Author

@Judahmeek I think this PR is OK. Can you check and we can release a 12.0.5 if you say it's good.

@Judahmeek
Copy link
Contributor

@justin808 LGTM. Should we change line 8 to default to "production" since webpack will default to production if a mode isn't set?

@justin808
Copy link
Member Author

@justin808 LGTM. Should we change line 8 to default to "production" since webpack will default to production if a mode isn't set?

No. That's for rails_env...and it's fine.

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.

3 participants