Blank page and “Unknown name” error in vue.esm.js

2019-08-27 23:04发布

Internet Explorer 11 and Microsoft Edge shows me a blank page when loading my Vue app. Console logs shows an "Unknown name" error pointing to the line "throw e" in 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

I am using babel-polyfill (imported in main.js: import 'babel-polyfill'). my Package.json file:

{
  "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"
  ]
}

Im lazily loading the routes in vue-router, e.g.:

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

I am getting the error just when loading my "Home" Component. No problems with Chrome, Firefox or Safari.

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-27 23:26

I have found the problem - was my mistake (syntax). I had :key:="xyz" in my v-for loop (should be :key="xyz").

查看更多
登录 后发表回答