kit chan kit chan - 7 months ago 55
Node.js Question

envify in react.js doesn't work

I am new to node.js and react.js.
I recently learn react.js and follow the instruction on react.js offical page and try to use production mode.
So i start with the code in main.js

var React = require('react');
var ReactDOM = require('react-dom');

<h1>Hello, world!</h1>,

and browserify it

$ browserify -t [ babelify --presets [ react ] ] -t [ envify --NODE_ENV production ] main.js -o bundle.js

But envify seems not work. The result bundle code still contain


Is something wrong? I 've tried to set
in the main.js. But it doesnt work. can anyone help me? thanks.


Set the NODE_ENV variable in the shell instead.

NODE_ENV=production browserify -t [ babelify --presets [ react ] ] -t envify main.js -o bundle.js