在babel.config.js中添加以下代码:
module.exports = {
presets: [
['@vue/app', {
useBuiltIns: 'entry',
}],
],
// 添加以下代码
"env": {
"production": {
// 关闭严格模式
"plugins": ["transform-remove-strict-mode"]
}
}
}
以上代码在生产环境下禁用Strict模式,解决了@vue/cli-plugin-babel/preset与Babel插件transform-remove-strict-mode不兼容的问题。