Description
Describe the bug
I pass import.meta.glob('./components/global/*.vue', {import: 'default', eager: true})
, Import global components in batches for registration. After I publish the theme package to npm, then install the theme package through npm installation. The temporary file generated in dev mode is stored in .vitepress/cache/deps
. However, the glob path is still ./components/global/*.vue
, resulting in failure to install the expected load to the file, can it be automatically converted to like ... /.. /.. /node_modules/vitepress-theme-async/components/global/*.vue
path.
At present, I am using the 'import.meta.env.dev' judgment, temporary processing, but vitepress working directory is variable, can not determine the user working directory level, is there a more reasonable way to handle this?
Reproduction
https://stackblitz.com/edit/vite-fw9cs4?file=docs%2Fposts%2Fdemo.md
Expected behavior
import.meta.glob in dev mode, the path can be correctly converted
System Info
System:
OS: Windows 10 10.0.19045
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700F
Memory: 25.12 GB / 31.82 GB
Binaries:
Node: 18.20.4 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD
npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Chromium (130.0.2849.52)
Internet Explorer: 11.0.19041.3636
Additional context
No response
Validations
- Check if you're on the latest VitePress version.
- Follow our Code of Conduct
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.