-
Notifications
You must be signed in to change notification settings - Fork 919
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
Feat: import.meta.glob and import.meta.globEager support #2881
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/pikapkg/snowpack/32VyjnDKximn3J9U7TKec1MUSMSX |
I'm pumped for this :) |
763da24
to
4165227
Compare
@@ -486,6 +486,11 @@ export function removeTrailingSlash(path: string) { | |||
return path.replace(/[/\\]+$/, ''); | |||
} | |||
|
|||
/** It's `Array.splice`, but for Strings! */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
|
||
it('import.meta.glob does not import its own source file', () => { | ||
expect(stripWS(files['/_dist_/globSelf.js'])).not.toContain('globSelf.js'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 Great tests. These test everything that I can think of. We may have someone requesting x or y for import globs down the line, but I think this is a great first cut (and may be all we ever need for import globs!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed in person, some notes:
|
Changes
Following up on #1165, this PR implements
import.meta.glob
andimport.meta.globEager
which mirror Vite's Glob Import support.Testing
Added tests in
test/build/import-glob
but these might need to be more thorough? LMK if you can think of any edge cases I'm missing.Docs
TODO