我们对JS的优化主要是从体积和代码层面上的优化 从体积现在比较流行的一些第三方的插件都有帮我们做一些压缩合并和混淆的事情 这里分享一个工具的网站里面有压缩JS的功能 如今早就已经过了那个需要手动压缩的年代了 webpack的JS压缩
{
test
: /\.js$/,
loader
: "babel-loader",
exclude
: /node_modules/
},
const uglify
= require('uglifyjs-webpack-plugin');
plugin
plugins
:[
new uglify()
]
转载请注明原文地址: https://mac.8miu.com/read-509441.html