IE11-错误:SCRIPT1004:应为';'
嗨!我的网站可以在除IE之外的所有浏览器上使用。我的babel.config.js文件:
module.exports = {
presets: [
['@vue/app', {
polyfills: [
'es.promise',
'es.symbol',
'es6.array.iterator'
]
}]
],
"plugins": [
"@babel/plugin-transform-shorthand-properties",
"@babel/plugin-proposal-object-rest-spread",
[
'component',
{
libraryName: 'element-ui',
styleLibraryName: 'theme-chalk'
}
]
]
}
---> Console screenshot
---> Debugger screenshot
您的调试器屏幕快照显示错误来自native-toast
程序包。该软件包的GitHub显示了unresolved issue,其中使用了for ... of
循环,这是导致Vue IE SCRIPT1004错误(这只是缺少的分号)的常见原因。
您可以告诉Vue CLI转换整个native-toast
依赖项程序包,这是默认情况下不会执行的操作。在您的vue.config.js
(不是Babel)中:
module.exports = {
transpileDependencies: [
'native-toast'
]
}
((注:transpileDependencies
是软件包名称的数组。)
显然,在某些情况下,您可能还需要在babel.config.js
中使用它(首先尝试不使用它:
module.exports = {
"presets": [
'@babel/preset-env'
],
}
参考:
transpileDependencies