代码压缩

  1. JS 代码压缩有哪些策略
    1. 去除换行,去除空白字符
    2. 长变量变成短变量
    3. 预计算
    4. 见terser更多策略配置

webpack中使用terser-webpack-plugin进行代码压缩

terser
compress: {
	drop_console: true //去除打包以后代码中的console
}



posted @ 2023-05-10 23:15  kitebear  阅读(20)  评论(0编辑  收藏  举报