-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
I'd like to dynamically import language files in highlight.js:
import.meta.glob(`highlight.js/lib/languages/*.js`)However, I get the following error:
[plugin:vite:import-analysis] Invalid glob import syntax: pattern must start with "." or "/" (relative to project root)
This works, but the results aren't very nice:
import.meta.glob(`../../node_modules/highlight.js/lib/languages/*`);Describe the solution you'd like
For the following API to work:
import.meta.glob(`highlight.js/lib/languages/*.js`)Describe alternatives you've considered
Manually hard-coding dynamic imports for each language.
Additional context
Would also be nice if Vite could display a warning if the dynamic import glob has 0 matches. Since it's kinda failing silently, I didn't realize I had the wrong path for a while.
renke, clysto, carlosvin, akvadrako and wizardpisces
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
