[使用Babel和Vue.js时IE 11出现SCRIPT错误

问题描述 投票:0回答:1

我们在Windows 10 / IE 11上的Vue.js应用程序遇到问题。

应用程序给出SCRIPT1003: Expected ':',直到我们将babel.config更新为以下内容:

module.exports = {
  presets: [
    [
      '@vue/cli-plugin-babel/preset',
      {
        targets: {
          'ie': '11'
        }
      }
    ]
  ]
}

此时错误是SCRIPT1002: Synxax Error chunk-vendors.js (11365, 9311),似乎与vuelidate节点模块有关。

似乎我需要exclude以上程序包,但我不知道语法应该在哪里。还有可能我需要排除多个软件包。

基础项目是使用vue-cli 4.4.1构建的,并且配置文件离库存安装位置还差得远

vue.js internet-explorer-11 babeljs
1个回答
0
投票

您要移植模块吗?您可以使用excludewebpack.config.js中的babel.config.js属性来转换模块。

您可以更改此行:

...
 exclude: /node_modules/,
...

进入此:

...
  exclude: /node_modules\/(?!name-of-untranspiled-module)/,
...

如果需要排除多个模块,可以像下面这样扩展异常列表:

exclude: /node_modules\/(?![module1|module2])/

有关更多信息,您可以参考this link

© www.soinside.com 2019 - 2024. All rights reserved.