-
Notifications
You must be signed in to change notification settings - Fork 12k
Request - set NODE_ENV="production" on prod build/serve #2110
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
Comments
@TheLarkInn can you weigh in? |
@gaearon is there any other way to flip this flag? Just want to know our available options. |
We just want |
Thank you very much, @gaearon. @filipesilva this would require a change, maybe falls into future add-on system. Though implementing this would likely not collide or conflict as the use case is probably edge. |
ng build --prod Should set NODE_ENV to production by default, im having this exact issue with Redux. Any workarounds? |
@TheLarkInn should this indeed use the future add-on system or is it ok to put this in the default production webpack configuration? Running into this issue as well, more then willing to put in a pull request. Been trying to find a workaround for it without having to fork and run my own version of the angular-cli but running out of ideas. |
Now that I think about it, can you not just set it manually via This seems to be a React specific thing and I'd rather not introduce changes to the build pipeline because of it. |
@filipesilva Just tried your suggestion but it didn't seem to work for me.
Still results in
|
That's because that check is being done runtime by Redux. What we need is the webpack define plugin to set NODE_ENV global variable within the bundle. It's not something React specific and it's probably gonna be needed for more packages. |
@rthewhite I'll reopen then, but haven't had any report outside of React/Redux so far so I have to say this isn't very high on the priority list. |
@filipesilva I can understand that it's not very high on the priority list. I'm more then willing to create a PR for it so you guys can see if it doesn't have any undesirable side effects and what the impact would be? |
That would be welcome, yes. I could bring up the implementation among the team and see what we decide. |
Thank you for solving this, didn't get to making the PR yet. Great that it's implemented now 👍 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OSX 10.11.6
ng --version
. If there's nothing outputted, please runin a Terminal:
node --version
and paste the result here:angular-cli: 1.0.0-beta.11-webpack.9-2
node: 6.5.0
os: darwin x64
do on your code? etc.
Include a npm package which uses React and run a prod-build/serve.
more information.
Warning: It looks like you're using a minified copy of the development build of React. When deploying React apps to production, make sure to use the production build which skips development warnings and is faster. See https://fb.me/react-minification for more details.
This can be solved by setting the NODE_ENV to "production" on prod build (i.e. set
process.env.NODE_ENV = 'production';
in build script). I'd be happy to submit a PR for this if interested.The text was updated successfully, but these errors were encountered: