Skip to content

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

Description

@viulu5824

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: hmrp2-nice-to-haveNot breaking anything but nice to have (priority)

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions