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

热更新失败,import.meta.glob会引起circular imports detected #15336

Closed
7 tasks done
viulu5824 opened this issue Dec 13, 2023 · 2 comments · Fixed by #15118
Closed
7 tasks done

热更新失败,import.meta.glob会引起circular imports detected #15336

viulu5824 opened this issue Dec 13, 2023 · 2 comments · Fixed by #15118
Labels
feat: hmr p2-nice-to-have Not breaking anything but nice to have (priority)

Comments

@viulu5824
Copy link

viulu5824 commented Dec 13, 2023

Describe the bug

我有一个路由组件user.vue,他引入了一个公共组件CommonList.vue
image
CommonList.vue中引入了user.js(pinia store模块);
image
在user.js中我写了动态生成路由的方法,其中使用了import.meta.glob来导入所有路由组件(包括 user.vue)进行动态加载。
image
但是这种导入让我每次修改user.vue,会提示circular imports detected,并给出了循环导入的顺序
image

Reproduction

https://stackblitz.com/edit/vitejs-vite-4sktev?file=vite-project%2Fsrc%2FApp.vue,vite-project%2Fsrc%2Ftest.js,vite-project%2Fsrc%2Fcomponents%2FHelloWorld.vue&terminal=dev

Steps to reproduce

cd vite-project
npm i
npm run dev
修改HelloWorld.vue会触发circular imports detected

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.10.5 - /usr/local/bin/pnpm

Used Package Manager

npm

Logs

No response

Validations

Copy link

stackblitz bot commented Dec 13, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@viulu5824 viulu5824 changed the title import.meta.glob会引起circular imports detected,导致热更新失败 热更新失败,import.meta.glob会引起circular imports detected Dec 18, 2023
@bluwy bluwy added feat: hmr p2-nice-to-have Not breaking anything but nice to have (priority) and removed pending triage labels Dec 22, 2023
@bluwy
Copy link
Member

bluwy commented Dec 22, 2023

This should be fixed in #15118

@bluwy bluwy linked a pull request Dec 22, 2023 that will close this issue
9 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: hmr p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants