Closed dmpx closed 6 years ago
Yes, just pass NODE_ENV=production
to webpack
:
"scripts": {
…
"build": "rimraf dist && cross-env NODE_ENV=production webpack --config ./webpack.production.config.js --progress --profile --colors",
…
},
(cross-env
is often needed to make it work on Windows)
# counting HOT_LOADER occurrences in the production build:
$ # without NODE_ENV=production:
$ grep -o HOT_LOADER dist/* | wc -l
$ 36
$ # with NODE_ENV=production:
$ grep -o HOT_LOADER dist/* | wc -l
$ 0 # nothing :)
Thanks @helb !
main.min.js
{"undefined"!=typeof REACT_HOT_LOADER&&(REACT_HOT_LOADER.register(a,"About","C:/Users/win/Desktop/wrr/app/components/About.js"),REACT_HOT_LOADER.register(u,"default","C:/Users/win/Desktop/wrr/app/components/About.js"))})()},
can remove REACT_HOT_LOADER?