Browserify / Babelify React for production (production NODE_ENV)

I ran this command:

browserify src.js -t [ babelify --presets [ react ] ] > build.js

and I get one file that can be used by its own. Works great, but NODE_ENV is set up for development, and I get console.log about downloading React DevTools.

How do I set it up for production? I walked around and found nothing that would work for me. I tried to think, but no luck (I am very new to JS builds).

I tried putting the -NODE_ENV version somewhere in the line above, but I am very new to the browser and babelify, so I basically make a trial version and error.

+4
source share
1 answer

NODE_ENV .

script :

NODE_PATH=./src/components:./src NODE_ENV=production browserify ./src/app.js --extension .jsx -t babelify -t brfs | uglifyjs > ./dist/main.js

, envify,

+5

Source: https://habr.com/ru/post/1619620/


All Articles