Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.4k 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 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...