Skip to content

Don't set NODE_ENV in assets.rake#1356

Merged
justin808 merged 1 commit intoshakacode:masterfrom
alexrozanski:master
Feb 26, 2021
Merged

Don't set NODE_ENV in assets.rake#1356
justin808 merged 1 commit intoshakacode:masterfrom
alexrozanski:master

Conversation

@justin808
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@justin808 justin808 merged commit 75f3a83 into shakacode:master Feb 26, 2021
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