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 evelopment pattern is not work #4342

Open
4 tasks done
MaLuns opened this issue Nov 7, 2024 · 1 comment
Open
4 tasks done

import.meta.glob evelopment pattern is not work #4342

MaLuns opened this issue Nov 7, 2024 · 1 comment
Labels
bug: pending triage Maybe a bug, waiting for confirmation

Comments

@MaLuns
Copy link

MaLuns commented Nov 7, 2024

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.

image
image

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?

image

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

@MaLuns MaLuns added the bug: pending triage Maybe a bug, waiting for confirmation label Nov 7, 2024
@MaLuns
Copy link
Author

MaLuns commented Nov 7, 2024

The build is fine. The problem only happens in dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: pending triage Maybe a bug, waiting for confirmation
Projects
None yet
Development

No branches or pull requests

1 participant