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

Add option to suppress minified build warning #1548

Closed
jtheisen opened this issue May 16, 2018 · 10 comments · Fixed by #1835
Closed

Add option to suppress minified build warning #1548

jtheisen opened this issue May 16, 2018 · 10 comments · Fixed by #1835

Comments

@jtheisen
Copy link

jtheisen commented May 16, 2018

MobX doesn't like to be minified while not having the NODE_ENV set to production:

you are running a minified build, but 'process.env.NODE_ENV' was not set to 'production' in your bundler. This results in an unnecessarily large and slow bundle

I want both minification and keeping the React logging which won't happen with the suggested setting.

I don't think performance will be an issue for me.

Is there a way to get rid of that warning?

@mweststrate
Copy link
Member

Afaik MobX follows the exact same pattern as React here. React will give the same error if I am not mistaken?

@jtheisen
Copy link
Author

jtheisen commented May 22, 2018

It sure used to. I think that's no longer the case.

@avioli
Copy link

avioli commented Jun 29, 2018

@jtheisen Fork it and remove the offending check?

@mweststrate
Copy link
Member

Or https://www.npmjs.com/package/patch-package, it's awesome!

@chase-moskal
Copy link

chase-moskal commented Aug 24, 2018

i'm also having this issue, but i can't figure out how else to express how productive i want my node env to be:

NODE_ENV=production browserify source/global.ts --debug -p [ tsify ] -t [ envify --NODE_ENV production ] -t uglifyify | uglifyjs -cm > dist/global.bundle.js

how can i satisfy the warning and fix my bundle?

edit: hey hey, i think i figured it out.. the following works:

NODE_ENV=production browserify source/global.ts -p [ tsify ] -g [ envify --NODE_ENV production ] -t uglifyify | uglifyjs -cm > dist/global.bundle.js

the difference that made it work, was simple changing the -t before [ envify to a -g instead

apparently that makes it globally affect the bundling or something

@avioli
Copy link

avioli commented Aug 24, 2018

@chase-moskal That comment is for the browserify project. Not MobX.

@chase-moskal
Copy link

@avioli -- well sure, but i was reacting to this warning coming out of mobx:

"you are running a minified build, but 'process.env.NODE_ENV' was not set to 'production' in your bundler. This results in an unnecessarily large and slow bundle"

in my case, my answer was to change a browserify flag

hopefully some folks in my situation will find this tip

cheers

@mweststrate
Copy link
Member

If somebody wants to add a configure option that supresses this warning, PR is welcome

@mweststrate mweststrate changed the title MobX warning when a development build is minified Add option to suppress minified build warning Nov 30, 2018
mweststrate added a commit that referenced this issue Dec 11, 2018
fix: add a configure env variable to mute minification warning (fix #1548)
@mweststrate
Copy link
Member

See release notes of 4.8.0 / 5.8.0, it is now possible to override this using a global env variable (make sure to configure it in your build setup)

@lock
Copy link

lock bot commented Jul 21, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants