-
安装ncu版本管理器
npm install npm-check-updates
使用ncu
命令查看可以升级的插件ncu -u 插件名
进行定义升级 -
注意:
ncu -u element-ui
之后一定要使用npm install
更新插件 -
ncu -u
出现问题
- ncu : 无法加载文件 D:\nodejs\ncu.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go. microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
需要以管理员方式打开powershell
运行命令:set-ExecutionPolicy RemoteSigned
- 升级成功之后修改
utils.js
这个配置文件
修改为if (options.extract) { loaders.push(MiniCssExtractPlugin.loader) } else { loaders.push('vue-style-loader') }
if (options.extract) { loaders.push({ loader: MiniCssExtractPlugin.loader, options: { publicPath: '../../' } }) } else { loaders.push('vue-style-loader') }
- 打包删除
console.log
找到
webpack.prod.conf.js
这个配置文件 找到以下代码
修改为optimization: { minimizer: [ new UglifyJsPlugin({ uglifyOptions: { mangle: { safari10: true } }, sourceMap: config.build.productionSourceMap, cache: true, parallel: true }), // Compress extracted CSS. We are using this plugin so that possible // duplicated CSS from different components can be deduped. new OptimizeCSSAssetsPlugin() ] }
optimization: { minimizer: [ new UglifyJsPlugin({ uglifyOptions: { mangle: { safari10: true }, compress: { // webpack打包时删除console.log warnings: false, drop_debugger: true, drop_console: true } }, sourceMap: config.build.productionSourceMap, cache: true, parallel: true }), // Compress extracted CSS. We are using this plugin so that possible // duplicated CSS from different components can be deduped. new OptimizeCSSAssetsPlugin() ] }