配置 HTML 控制压缩

 // 使用数组
    plugins:[
        new HtmlWebpackPlugin({
            // 自己定义的html 模板
            template:'./src/index.html' ,
            // 输出后的文件名
             filename:'index.[hash].html',
            // filename:'index.html',
            //  js后面加 hash(清除缓存)
            // hash: true 
            // 控制压缩
            minify:{
                // 去除空格
                collapseWhitespace: true,
                removeComments:true,
                removeAttributeQuotes:true,
                removeEmptyAttributes:true
            }
        })
    ]
posted @ 2021-03-12 15:59  13522679763-任国强  阅读(47)  评论(0)    收藏  举报