You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why do we need the first line? From what I can tell, the files are picked based on the NODE_ENV, so it seems impossible that this is out of sync. Furthermore, we could set the NODE_ENV if not set before running the file.
Here is where the NODE_ENV is used to pick what file is used, so I'm a bit puzzled as to how the NODE_ENV might not be set.
The text was updated successfully, but these errors were encountered:
justin808
changed the title
Necessary to set the NODE_ENV
Necessary to set the NODE_ENV in install files like config/webpack/production.js?
Feb 15, 2020
I do agree that there could be room for tightening, but I haven't really done any dev work in this part of the codebase. It's kinda always "just worked". The only thing I would look out for is to ensure that users can still override the NODE_ENV from both the cmd line (running bins) & environment.js. (I'm not sure which would take precedence 🤔)
It probably does no harm to keep it to ensure that it's set in case one will use a specific webpack config directly rather than calling the Rails bin/webpack.
All the install files have this:
Why do we need the first line? From what I can tell, the files are picked based on the NODE_ENV, so it seems impossible that this is out of sync. Furthermore, we could set the NODE_ENV if not set before running the file.
Here is where the NODE_ENV is used to pick what file is used, so I'm a bit puzzled as to how the NODE_ENV might not be set.
https://github.com/rails/webpacker/blob/master/lib/webpacker/runner.rb#L14
If needed, we could set the process.env.NODE_ENV since these files are all run from the:
https://github.com/rails/webpacker/blob/master/lib/webpacker/webpack_runner.rb#L23
I left a code comment where this was introduced.
e616184#r37306278
The text was updated successfully, but these errors were encountered: