vue js代码打包加密
安装两个依赖npm install --save-dev webpack-obfuscator@2.6.0 javascript-obfuscator@2.6.0
vue.config.js中引入 const WebpackObfuscator = require(‘webpack-obfuscator’);
生产环境配置
configureWebpack(config) {
if (process.env.NODE_ENV === ‘production’) {
config.plugins.push(new WebpackObfuscator({
rotateStringArray: true
}, []))
}
},