vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
http://v2.vuejs.org
MIT License
207.73k stars 33.68k forks source link

加载异步组件报错。 #7285

Closed dclovec closed 6 years ago

dclovec commented 6 years ago

Version

2.2.4

Reproduction link

https://codepen.io/

Steps to reproduce

无法提供重现环境,这个问题是随机出现的。一个月前的某个时刻开始出现。

我的系统整体有几百个组件和模块,异步组件大概有200个。使用webpack2 vue2.2.4 vue-router2.3.0 vuex2.2.1。vue-router使用hash模式。

What is expected?

异步组件加载成功

What is actually happening?

在一段时间内,某个异步组件会加载失败。

然后过几天,这个问题会随机转移到另外一个异步组件上,出错的异步组件不是特定的。

只要是从其他组件跳转到这个异步组件就会加载失败。但是加载失败后,F5刷新页面,异步组件又会加载成功。


测试过更新vue全家桶到最新和webpack3最新版,还是有这个问题。

报错信息: [Vue warn]: Failed to resolve async component: function (){var n={};return t.commit("loading",n),e().then(function(e){return n.close(),Promise.resolve(e)}).catch(function(e){return n.close(),Promise.reject(e)})} Reason: TypeError: Cannot read property 'call' of undefined

posva commented 6 years ago

Even if it doesn' fail every time, we need a proper boiled down reproduction (for example, you should be able to remove vuex and vue-router). It can be a github repository, but it's important you boil it down to the minimal. You may even find where the problem came this way 🙂 We need this to make sure you're reporting a bug and not just asking a question as we have the forum and the Discord server for that I'm closing this for the moment but if you boil it down and still think it's a vue bug, come back and open a new issue

dclovec commented 6 years ago

OK, thanks