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

NODE_ENV environment variable under webpacker:compile is fixed at "production" #2038

Closed
finfin opened this issue Apr 1, 2019 · 2 comments
Closed

Comments

@finfin
Copy link

finfin commented Apr 1, 2019

Scenario

Our system has three stages: development, staging
Thus we need three separate webpack config

What Happened

RAILS_ENV controls what configuration webpacker will use using webpacker.yml
NODE_ENV controls what webpacker will use to customize webpack config

It works as expected when deploying in production
But when NODE_ENV is set to staging, webpack config seems to always loads production.js

After some digging, I found that node_env is forced to "production" when deploying

Webpacker.with_node_env("production") do

But under our scenario we need node_env other then production (even when deploying)

Possible solution

A customizable property in webpacker.yml that can assign what node_env we're using (or what webpack config custom file to use)

@jakeNiemiec
Copy link
Member

‘staging’ is not a valid ‘NODE_ENV’. If you are deploying to a staging server I would recommend setting it to ‘production’.

There are several other issues discussing this at length, it would probably be better to actively talk about this on one of those.

@finfin finfin closed this as completed Apr 1, 2019
@finfin
Copy link
Author

finfin commented Apr 1, 2019

Duplicate of #1395 #1558 #1696

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

No branches or pull requests

2 participants