vue-cli搭建的后台项目在IE报错,求各位帮忙啊

1.项目在IE中无法运行,报错
2.错误代码
图片描述

图片描述

3.我已经下载并引入相关将es6变为es5以及babel.lrc文件

{
  "name": "litadmin",
  "version": "1.0.0",
  "description": "A Vue.js project",
  "author": "jerry9022@qq.com",
  "private": true,
  "scripts": {
    "dev": "node build/dev-server.js",
    "build": "node build/build.js"
  },
  "dependencies": {
    "axios": "^0.16.1",
    "axios-mock-adapter": "^1.8.1",
    "babel-helper-vue-jsx-merge-props": "^2.0.2",
    "babel-plugin-syntax-jsx": "^6.18.0",
    "babel-plugin-transform-vue-jsx": "^3.5.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-es2015-loose": "^8.0.0",
    "bootstrap": "^3.3.7",
    "echarts": "^3.5.3",
    "element-ui": "^1.2.8",
    "es3ify-loader": "^0.2.0",
    "gridly": "^1.4.10",
    "gridstack": "^0.3.0",
    "highcharts": "^5.0.12",
    "jquery": "^3.2.1",
    "jquery-ui": "^1.12.1",
    "jquery-ui-bundle": "^1.12.1",
    "jquery.gridly": "^1.2.9",
    "jqueryui": "^1.11.1",
    "knockout": "^3.4.2",
    "lodash": "^4.17.4",
    "mockjs": "^1.0.1-beta3",
    "socketcluster": "^6.0.1",
    "socketcluster-client": "^5.5.2",
    "vue": "^2.2.2",
    "vue-highcharts": "0.0.10",
    "vue-router": "^2.2.0",
    "vuex": "^2.3.1"
  },
  "devDependencies": {
    "autoprefixer": "^6.7.2",
    "babel-core": "^6.22.1",
    "babel-loader": "^6.2.10",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-preset-env": "^1.2.1",
    "babel-preset-stage-2": "^6.22.0",
    "babel-register": "^6.22.0",
    "chalk": "^1.1.3",
    "connect-history-api-fallback": "^1.3.0",
    "copy-webpack-plugin": "^4.0.1",
    "css-loader": "^0.26.4",
    "element-ui": "^1.2.7",
    "eventsource-polyfill": "^0.9.6",
    "express": "^4.14.1",
    "extract-text-webpack-plugin": "^2.0.0",
    "file-loader": "^0.10.0",
    "friendly-errors-webpack-plugin": "^1.1.3",
    "function-bind": "^1.1.0",
    "html-webpack-plugin": "^2.29.0",
    "http-proxy-middleware": "^0.17.3",
    "node-sass": "^4.5.2",
    "opn": "^4.0.2",
    "optimize-css-assets-webpack-plugin": "^1.3.0",
    "ora": "^1.1.0",
    "rimraf": "^2.6.0",
    "sass-loader": "^6.0.3",
    "script-loader": "^0.7.0",
    "semver": "^5.3.0",
    "style-loader": "^0.16.1",
    "url-loader": "^0.5.7",
    "vue-loader": "^11.1.4",
    "vue-style-loader": "^2.0.0",
    "vue-template-compiler": "^2.2.4",
    "webpack": "^2.2.1",
    "webpack-bundle-analyzer": "^2.2.1",
    "webpack-dev-middleware": "^1.10.0",
    "webpack-hot-middleware": "^2.16.1",
    "webpack-merge": "^2.6.1"
  },
  "engines": {
    "node": ">= 4.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

4.求大神解决下

阅读 8.7k
8 个回答

并不是webpack配置问题。也不是babel没编译。

这个锅其实是 webpack-dev-server的问题。它里面通过socket给浏览器的代码有 部分 es6的代码 如 const 这些。然后这种东西ie11以下并不认识
翻了webpack-dev-server的源码
https://github.com/webpack/we...

解决办法降低webpack-dev-server的版本。具体到多少。。懒得翻了。。

没有定位到具体的错误,不过我遇到过ie全家报错的情况,是Promise对象的锅!
加了个promise-polyfill之后解决了,虽然IE9-不能使用vue,但是好歹不报错。

报错之前那句写的很清楚了 添加个polyfill-eventsource

你的polyfill不适用你的ie版本

新手上路,请多包涵

遇到同样的问题,问题有解决吗

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏