Answer the question
In order to leave comments, you need to log in
How to minify code and js libraries with webpack?
My project is built with Webpack and uses about 20 npm libraries, including big ones like Angular.js. You need to minify the code to release the product. I understand that it is worth using a plugin for this webpack.optimize.UglifyJsPlugin
, however, several questions arise:
Answer the question
In order to leave comments, you need to log in
Of course, you need to minify everything, because libraries are also not minified. Moreover, you need to minify only before deploying to production. I have it done like this:
if (process.env.NODE_ENV === 'production') {
plugins.push(new webpack.optimize.UglifyJsPlugin({compressor: {warnings: false}}));
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question