I want to minify my files using uglifyjs-webpack.
For example I have a source file core/js/test
and want to minify it and send it to min/js/test
.
Just using a source and respective output, how do I use it with webpack.
I often just use the optimization: {minimize: true}
option (see this) since webpack 4.
const path = require("path");
module.exports = {
context: __dirname,
entry: "/origin/main.js",
output: {
path: path.resolve("./min/js/"),
filename: "test.js"
},
optimization: {
minimize: false
}
};
However, webpack still allows you to override the default implementation using the UglifyjsWebpackPlugin
. I'd advise you to have a look at the docs in here, they seem to explain it quite alright.