webpack 之压缩js代码 和html文件
1.压缩JS代码,mode设置为production后,打包时自动压缩代码
mode:‘production‘,
2.压缩html文件,html文件不需要处理兼容问题,压缩文件只需要在plugins中的HtmlWebpackPlugin中配置minify即可
new HtmlWebpackPlugin({
template:‘./src/index.html‘,
minify:{
//移除空格
collapseWhitespace:true,
//移除注释
removeComments:true
},
}), 相关推荐
yezitoo 2020-06-13
不知道该写啥QAQ 2020-11-12
webfullStack 2020-11-09
Yvettre 2020-09-15
想做大牛的蜗牛 2020-10-30
gaojie0 2020-09-11
SelinaChan 2020-08-14
不知道该写啥QAQ 2020-08-09
gloria0 2020-08-09
不知道该写啥QAQ 2020-08-02
hline 2020-07-29
SelinaChan 2020-07-28
wangdianyong 2020-07-23
webpackvuees 2020-07-23
yqoxygen 2020-07-20
不知道该写啥QAQ 2020-07-18
waterv 2020-07-18