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

Remove Redux environment warning in production #4341

Merged
merged 2 commits into from Jul 25, 2018
Merged

Remove Redux environment warning in production #4341

merged 2 commits into from Jul 25, 2018

Conversation

himdel
Copy link
Contributor

@himdel himdel commented Jul 24, 2018

When running in production, there is a warning in the console:

You are currently using minified code outside of NODE_ENV === 'production'.
This means that you are running a slower development build of Redux.
You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify
or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) 
to ensure you have the correct code for your production build.

That warning is present in both redux and ng-redux, but appears only because we're using the pre-built version of ng-redux, which was built with the development environment.

So... moving ng-redux to webpack so that we compile our own environment-dependnent version.


Also changed how we expose the environment - previously, for some reason we would take all the environment and pass it as a list of defaults to EnvironmentPlugin.

Now, we're only explicittly sharing NODE_ENV.


Testing:

RAILS_ENV=production NODE_ENV=production bin/rake assets:precompile
UNSAFE_PG_VERSION=true RAILS_SERVE_STATIC_FILES=true RAILS_ENV=production be bin/rails s

Check the browser console on the login screen.


(As far as I know, this is just a warning, no point in backporting unless somebody complains.)

instead of blindly copying the whole environment
because the dist file has a hardcoded warning printed out when the file is minified:

```
if ("development" !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
  warning('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
```
@himdel himdel added the bug label Jul 24, 2018
@miq-bot
Copy link
Member

miq-bot commented Jul 24, 2018

Checked commits https://github.com/himdel/manageiq-ui-classic/compare/7face4f7bbda7964c5867844f7084f75c2ea6407~...4caf5a311750c7f2f989d8cf1a4ceaaab766a791 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
0 files checked, 0 offenses detected
Everything looks fine. 🍰

@himdel
Copy link
Contributor Author

himdel commented Jul 24, 2018

cc @Hyperkid123 can you make sure this doesn't break ngRedux please? :)

@mzazrivec
Copy link
Contributor

I'm OK with this change, as long as @Hyperkid123 agrees here.

Copy link
Contributor

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested on some connected components and its working like before.

@mzazrivec mzazrivec self-assigned this Jul 25, 2018
@mzazrivec mzazrivec added this to the Sprint 91 Ending Jul 30, 2018 milestone Jul 25, 2018
@mzazrivec mzazrivec merged commit 5a90cdc into ManageIQ:master Jul 25, 2018
@himdel himdel deleted the webpack-environment branch July 26, 2018 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants