node.js - Webpack builds on production environment -
in react js starter kits 1 @ https://github.com/wallacyyy/reactly-starter-kit, see package.json files have content this:
"scripts": { "build": "cross-env node_env=production webpack --config ./webpack.prod.config.js --progress --colors", ... }, "dependencies": { "express": "^4.15.2", "react": "^15.5.4", "react-dom": "^15.5.4" }, "devdependencies": { "webpack": "^2.2.1", "webpack-dev-server": "^2.4.2" }
the build script uses webpack process production build. how able run on production when webpack devdependency?
webpack doesn't run on production environment. build
script sets node_env
variable equals production
, letting webpack , plugins know should prepare bundle production use. happens when run command depends on webpack configuration, among common things code minification. can specify different kind of source maps , many other things. see https://webpack.js.org/guides/production/ more information.
Comments
Post a Comment