Webpack how to build production code and how to use it

You can add the plugins as suggested by @Vikramaditya.
Then to generate the production build. You have to run the the command

NODE_ENV=production webpack --config ./webpack.production.config.js

If using babel, you will also need to prefix BABEL_ENV=node to the above command.

Leave a Comment