Skip to content

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