Turbopack: fix chunking for lazy import.meta.glob matches (#100522)
## Summary Non-eager `import.meta.glob` matches were referenced with a parallel chunking type, so every matched module was compiled and shipped in the importing module's chunk group. Only evaluation was deferred to the thunk, so the "lazy" mode did not actually code-split. Lazy matches now use an async edge and load through their async loader, the same as a dynamic `import()`. Each match gets its own chunk, loaded when its thunk is called. Eager matches are unchanged. ## Verification - New snapshot test `turbopack-tests/tests/snapshot/imports/import-meta-glob` shows lazy matches in separate async chunks and the eager match in the entry chunk. - Existing `import-meta-glob*` and `side-effects-glob` execution tests pass. <!-- NEXT_JS_LLM -->
Showing
Please
register
or
sign in
to comment