Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.9k views
in Technique[技术] by (71.8m points)

Vue IE11报错

问题:
vue-cli3.0打包后用IE11打包报错
报错如下:
SCRIPT1006: 缺少 ')'
chunk-vendors.0e4045c9.js (221,12985)
image.png
尝试解决的办法:
在网上百度的 都说要配置babel/polyfill,项目中已经下载,并且引用了
1.在main.js中引入了

import 'babel-polyfill';

2.在babel.config.js中配置了

module.exports = {
  presets: [
    [
      '@vue/app', {
        useBuiltIns: 'entry',
        polyfills: [
          'es6.promise',
          'es6.symbol',
          'es6.array.find-index',
          'es7.array.includes',
          'es6.string.includes',
        ]
      },
    ]
  ]
};

3.package.json

"devDependencies": {
    "@vue/cli-plugin-babel": "~4.4.0",
    "@vue/cli-plugin-eslint": "~4.4.0",
    "@vue/cli-plugin-router": "~4.4.0",
    "@vue/cli-plugin-unit-jest": "~4.4.0",
    "@vue/cli-plugin-vuex": "~4.4.0",
    "@vue/cli-service": "~4.4.0",
    "@vue/eslint-config-prettier": "^6.0.0",
    "@vue/test-utils": "^1.0.3",
    "babel-eslint": "^10.1.0",
    "babel-polyfill": "^6.26.0",
    "es6-promise": "^4.2.8",
    "eslint": "^6.7.2",
    "eslint-plugin-prettier": "^3.1.3",
    "eslint-plugin-vue": "^6.2.2",
    "less": "^3.0.4",
    "less-loader": "^6.2.0",
    "lint-staged": "^9.5.0",
    "postcss-pxtorem": "^5.1.1",
    "prettier": "^1.19.1",
    "vue-template-compiler": "^2.6.11"
  },

这么修改后打包到IE中还是报错,请问有大佬遇到过这种情况吗?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

看名字里有 vendor,应该是某个第三方库代码里还有 es6 语法的代码,在 babel 配置里给他加上去就行


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...