vue.esm.js(Microsoft IE 11 和 Microsoft Edge)中的空白页和“未知名称”错误 [关闭]

Posted

技术标签:

【中文标题】vue.esm.js(Microsoft IE 11 和 Microsoft Edge)中的空白页和“未知名称”错误 [关闭]【英文标题】:Blank page and "Unknown name" error in vue.esm.js (Microsoft IE 11 and Microsoft Edge) [closed] 【发布时间】:2018-06-08 07:12:07 【问题描述】:

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

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'))
  )

我在加载“主页”组件时遇到错误。 Chrome、Firefox 或 Safari 都没有问题。

【问题讨论】:

你是否使用了一些计算属性,我在使用 IE 时遇到了问题 【参考方案1】:

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

【讨论】:

以上是关于vue.esm.js(Microsoft IE 11 和 Microsoft Edge)中的空白页和“未知名称”错误 [关闭]的主要内容,如果未能解决你的问题,请参考以下文章

vue-router.esm.js?8c4f:2181 TypeError:无法读取未定义的属性“loggedIn”

vue3 配置storybook报错 : Cannot find module ‘vue/dist/vue.esm.js‘

vue3 配置storybook报错 : Cannot find module ‘vue/dist/vue.esm.js‘

vue3 配置storybook报错 : Cannot find module ‘vue/dist/vue.esm.js‘

vue系列文章 --- 源码目录结构整理

vue-router.esm.js?8c4f:16 [vue-router] missing param for named route "magneto.xmqsDx.edit"