空白页面和"未知名称" vue.esm.js中的错误(Microsoft IE 11和Microsoft Edge)

时间:2017-12-27 16:35:13

标签: webpack vue.js babel vue-router polyfills

Internet Explorer 11和Microsoft Edge在加载我的Vue应用程序时向我显示一个空白页面。控制台日志显示"未知名称"指向该行的错误"抛出e"在vue.esm.js:

Watcher.prototype.get = function get () {
pushTarget(this);
var value;
var vm = this.vm;
try {
value = this.getter.call(vm, vm);
} catch (e) {
if (this.user) {
handleError(e,vm, ("getter for watcher \"" + (this.expression) + "\""));
} else {
    throw e // UNKNOWN NAME ERROR (IE and Edge) 
}
} finally {
// "touch every property so the are all tracked as

我正在使用babel-polyfill(在main.js中导入:import' babel-polyfill')。我的Package.json文件:

{
  "name": "xyz",
  "version": "1.0.0",
  "description": "xyz",
  "author": "xyz",
  "private": true,
  "scripts": {
    "dev": "node build/dev-server.js",
    "start": "node build/dev-server.js",
    "build": "node build/build.js",
    "lint": "eslint --ext .js,.vue src"
  },
  "dependencies": {
    "@xkeshi/image-compressor": "^0.5.2",
    "axios": "^0.17.1",
    "bulma": "^0.6.1",
    "bulma-extensions": "^0.5.2",
    "cropperjs": "^1.1.3",
    "vee-validate": "^2.0.0-rc.18",
    "vue": "^2.5.2",
    "vue-analytics": "^5.6.0",
    "vue-awesome-swiper": "^3.0.4",
    "vue-flatpickr-component": "^5.0.1",
    "vue-goodshare": "^0.9.2",
    "vue-masonry": "^0.10.16",
    "vue-meta": "^1.3.1",
    "vue-recaptcha": "^1.0.0",
    "vue-router": "^3.0.1",
    "vue-upload-component": "^2.6.3",
    "vue2-editor": "^2.3.11",
    "vue2-google-maps": "^0.8.4",
    "vuex": "^3.0.1",
    "vuex-persistedstate": "^2.4.2"
  },
  "devDependencies": {
    "autoprefixer": "^7.1.5",
    "babel-core": "^6.26.0",
    "babel-eslint": "^8.0.1",
    "babel-loader": "^7.1.2",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.6.0",
    "babel-preset-stage-2": "^6.24.1",
    "babel-register": "^6.26.0",
    "chalk": "^2.1.0",
    "connect-history-api-fallback": "^1.4.0",
    "copy-webpack-plugin": "^4.1.1",
    "css-loader": "^0.28.7",
    "cssnano": "^3.10.0",
    "eslint": "^4.9.0",
    "eslint-config-standard": "^10.2.1",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-loader": "^1.9.0",
    "eslint-plugin-html": "^3.2.2",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-node": "^5.2.0",
    "eslint-plugin-promise": "^3.6.0",
    "eslint-plugin-standard": "^3.0.1",
    "eventsource-polyfill": "^0.9.6",
    "express": "^4.16.2",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^1.1.5",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "html-webpack-plugin": "^2.30.1",
    "http-proxy-middleware": "^0.17.4",
    "node-sass": "^4.7.2",
    "opn": "^5.1.0",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "ora": "^1.3.0",
    "rimraf": "^2.6.2",
    "sass-loader": "^6.0.6",
    "semver": "^5.4.1",
    "shelljs": "^0.7.8",
    "sw-precache-webpack-plugin": "^0.11.4",
    "uglify-es": "^3.1.3",
    "url-loader": "^0.6.2",
    "vue-loader": "^13.3.0",
    "vue-style-loader": "^3.0.3",
    "vue-template-compiler": "^2.5.2",
    "webpack": "^3.8.1",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-middleware": "^1.12.0",
    "webpack-hot-middleware": "^2.21.0",
    "webpack-merge": "^4.1.0"
  },
  "engines": {
    "node": ">= 4.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

我懒洋洋地在vue-router中加载路由,例如:

const Home = resolve => {
  require.ensure(['@/components/Home'], () => {
    resolve(require('@/components/Home'))
  })
}

我正在加载我的&#34; Home&#34;零件。 Chrome,Firefox或Safari没有问题。

1 个答案:

答案 0 :(得分:4)

我发现了问题 - 是我的错(语法)。我有:key:=“xyz”在我的v-for循环中(应该是:key =“xyz”)。