I am very new to webpack, I found that in production build we can able to reduce the size of overall code. Currently webpack builds around 8MB files and main.js around 5MB.
You can add the plugins as suggested by @Vikramaditya. Then to generate the production build. You have to run the the command
webpack -p --config ./webpack.production.config.js
The -p
tells webpack to generate a production build. You have to change the build script in package.json to include the production flag.