-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add glob resolver plugin #5933
Add glob resolver plugin #5933
Conversation
|
Benchmark ResultsKitchen Sink ✅
Timings
Cold BundlesNo bundle changes detected. Cached Bundles
React HackerNews ✅
Timings
Cold Bundles
Cached Bundles
AtlasKit Editor ✅
Timings
Cold Bundles
Cached Bundles
Three.js ✅
Timings
Cold BundlesNo bundle changes detected. Cached Bundles
|
@@ -220,6 +221,10 @@ export class ResolverRunner { | |||
}; | |||
} | |||
|
|||
if (result.isAsync != null) { | |||
dependency.isAsync = result.isAsync; |
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.
Not totally sure how I feel about mutating the dependency in the resolver, but we did it already for meta... Otherwise we'd need to move isAsync
to the AssetGroup, but that's not available in the bundle graph. 😞
What is the current status on this? I am working on a project that should use url globs, and as I am relatively new to using Parcel I'm not sure of the best way to implement that. Is this PR expected to be merged soon? For now, I am going to just load the url for each file in my directory individually. (Is there some other plugin I should use instead for now?) Thanks! |
I also need this. Would be great if it will be merged. Thanks! |
Need this as well, urgently |
Very much anticipating this functionality. Doing "animated PNGs" in my current project, which currently involves importing each frame image separately... Loving Parcel, but being able to eliminate hundreds of lines of repetitive code would be a great boon. |
This PR would also benefit a lot a project I'm working on with parcel. |
We encountered the node-gyp/deasync problem in Parcel 1 (#5294), so we tried to upgrade to Parcel 2. It doesn't do glob imports, so we can't use it. This PR fixes that problem, but 3 months have passed with no activity. So we're stuck on old versions of Node and Parcel. I'd rather not have to move everything off Parcel and onto esbuild, but if this isn't fixed then I'll have to eventually. |
Can you use the babel plugin in the meantime? https://github.com/devongovett/babel-plugin-transform-glob-import I believe the current state was that there was disagreement among the core team about how dynamic import should be handled. I hope to get back to this soon. |
@devongovett Thanks, I'll give it a try. |
@RickyRomero When you're done, could you let us know how it goes for you? Thanks! |
@devongovett @DarthFloopy Here's where I got following the migration guide for Parcel 2:
The glob imports we use are for .mp4 files. Our app's video imports look like this: import videos from '../../../../projects-data/**/*.mp4'; Prepending Judging from what little I know about Parcel 2, it seems like I should be using the |
# Conflicts: # packages/core/core/src/AssetGraph.js # yarn.lock
Benchmark ResultsKitchen Sink ✅
Timings
Cold Bundles
Cached Bundles
React HackerNews ✅
Timings
Cold BundlesNo bundle changes detected. Cached Bundles
AtlasKit Editor ✅
Timings
Cold Bundles
Cached Bundles
Three.js ✅
Timings
Cold BundlesNo bundle changes detected. Cached Bundles
|
Fixes #4683
This creates a
@parcel/resolver-glob
plugin which resolves glob specifiers. It's not currently in the default config, but can be enabled by adding it to your.parcelrc
. It works identically to the Parcel v1 version for JS, and also works for CSS. In addition, it works with pipelines likeurl:
, and also for dynamic import. See the tests for examples.