Here is the webpack configuration I use to prepare for production script
config.output.filename = '[hash].main.js';
config.module.loaders.push({
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/,
include: path.join(__dirname, 'app'),
});
However for debug purpose I want to be able to generate the final output xxxx.main.js
without any minification or optimisation.
How can I achieve that with the above configuration?
I am actually not very familiar with webpack/babel tooling so I actually not sure if it is babel or webpack which executed the minification
It is almost certainly webpack which minifies your bundle, babel would only minify the sources passed through the loader, not the entire bundle.
There are two ways you could have enabled minification, adding the UglifyJsPlugin
to your config or using the CLI flag --optimize-minimize
or -p
which enables production mode which automatically sets --optimize-minimize
.
If you're using the plugin, you can remove it from plugins
in your config (or set it conditionally for example with an environment variable), and if you're using one of the mentioned flags you can simply run webpack without them to get the non-minified bundle.
See also Building for Production.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With