Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request.js 文件依赖import store from '@/store',会导致编译循环依赖RangeError: Maximum call stack size exceeded #6

Closed
BarronLin opened this issue Nov 7, 2018 · 9 comments

Comments

@BarronLin
Copy link

比如把这个import { getRoleList, getServiceList } from '@/api/manage' 放到任何一个vue文件引用,都会报错。

@sendya
Copy link
Member

sendya commented Nov 8, 2018

06303db

vuejs/vue-cli#2463

@BarronLin
Copy link
Author

作者大大,那现在vue cli官方都没人去修,我们现在怎么办?

@sendya
Copy link
Member

sendya commented Nov 8, 2018

经测试没有你描述的问题发生,你可以看一下提交内容。确实有引用到这两个方法,并且这个两个方法的引用在 TableList.vue 也用到了。

7282264#diff-ff155d4a440197a6f84e8714fd6374e9R153

@BarronLin
Copy link
Author

经测试没有你描述的问题发生,你可以看一下提交内容。确实有引用到这两个方法,并且这个两个方法的引用在 TableList.vue 也用到了。

7282264#diff-ff155d4a440197a6f84e8714fd6374e9R153

import { getRoleList, getServiceList } from '@/api/manage' 你可以放到其他page文件,比如workplace.vue 就会编译出上面错误的,作者大大有联系方式可以交流下吗?

@sendya
Copy link
Member

sendya commented Nov 8, 2018

你也可以尝试在 request.js 里去掉 import store from '@/store' 以及 21 行的

store.dispatch('Logout').then(() => {
        location.reload()
      })

@sendya
Copy link
Member

sendya commented Nov 8, 2018

@BarronLin
Copy link
Author

这是测试代码

https://github.com/sendya/ant-design-pro-vue/blob/master/src/views/dashboard/Workplace.vue#L120

20181108165652

这是注释掉“你也可以尝试在 request.js 里去掉 import store from '@/store' 以及 21 行的”之后尝试的吗

@sendya
Copy link
Member

sendya commented Nov 9, 2018

没注释哦,你可以拉完整代码在你本地跑试试

@sendya sendya closed this as completed Nov 10, 2018
@OJesusO
Copy link

OJesusO commented Nov 24, 2018

const _import = file => () => import(`@/views/${file}`).then(m => m.default)

换成

const _import = file => require(`@/views/${file}`).default

可以跑成功 0.0

@BarronLin 不知道对你有无用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants