[英]How to minify a source file (Javascript) into a minify file using uglifyjs-webpack
I want to minify my files using uglifyjs-webpack.我想使用 uglifyjs-webpack 缩小我的文件。
For example I have a source file core/js/test
and want to minify it and send it to min/js/test
.例如,我有一个源文件core/js/test
并希望将其缩小并将其发送到min/js/test
。
Just using a source and respective output, how do I use it with webpack.仅使用源和相应的输出,我如何将它与 webpack 一起使用。
I often just use the optimization: {minimize: true}
option ( see this ) since webpack 4.从 webpack 4 开始,我经常只使用optimization: {minimize: true}
选项( 见这个)。
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
.但是,webpack 仍然允许您使用UglifyjsWebpackPlugin
覆盖默认实现。 I'd advise you to have a look at the docs in here , they seem to explain it quite alright.我建议你看看这里的文档,他们似乎解释得很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.