-
Notifications
You must be signed in to change notification settings - Fork 57
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
It's not working #56
Comments
FWIW I'm seeing the same thing with almost identical code. But I've noticed something else:
Does not work, even when I have
does work. It seems that |
@Kryten0807 I solved this problem without using this, could be useful in your current situation. This is the code what am I did: https://github.com/rico345100/gulp-react-boilerplate/blob/master/gulpfile.js Important thing is that when you bundling React with bundler, it checks process.NODE_ENV is production or not. So it's super easy with just add this simple line anywhere before bundle: process.env.NODE_ENV = 'production'; It's now 100% working, without adding NODE_ENV=production in command line :) |
@rico345100 The issue in the original post is caused by the fact that browserify does not run the transforms on
|
@InvictusMB That's a really good information, Thanks! I'm gonna try that. |
Correction to @InvictusMB, the config must come first: browserify()
.require(requirements)
.transform({ global: true }, envify({NODE_ENV: 'production'}))
.bundle()
.pipe(output); But ☝️ tripped me up because one must import This also works: const options = {
transform: [
['envify', { NODE_ENV: 'production', global: true}]
],
};
browserify(options)
.require(requirements)
.bundle()
.pipe(output); |
I'm using Browserify, and when I minified JS code with using React and Redux, it saids:
So I added envify and used like this:
You can see that when it's production mode, it calls envify, also I printed "envify" on the console when it runs.
After run the browserify(with gulp), it saids 'envify':
But still same errors on the webbrowser's console:
I'm running multiple node services on single server, so I can't set NODE_ENV to production, because some of them are still in development mode. Is there a something that I missed? Why it won't worked at all?
I'm using
The text was updated successfully, but these errors were encountered: