dynamic-import-node
插件。如果要避免生产环境下在控制台打印console
的信息,下载安装 babel-plugin-transform-remove-console
安装方式如下:
yarn add babel-plugin-transform-remove-console
yarn add dynamic-import-node
babel.config.js文件代码如下:
ps:
webpack3下面没有webpack.prod.conf.js 配置文件了,需要在根目录自行创建babel.config.js
即可。
// 生产环境下清除console打印
const plugins = []
if (process.env.NODE_ENV === 'production') {
plugins.push('transform-remove-console')
}
module.exports = {
presets: [
'@vue/app'
],
plugins,
'env': {
'development': {
// babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
// This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
// https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html
'plugins': ['dynamic-import-node']
}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)