Skip to content

Filter availability info to only what is relevant - #98611

Draft
lukesandberg wants to merge 2 commits into
ast_paths_live_a_long_timefrom
async_chunking_availability_explosion
Draft

Filter availability info to only what is relevant#98611
lukesandberg wants to merge 2 commits into
ast_paths_live_a_long_timefrom
async_chunking_availability_explosion

Conversation

@lukesandberg

@lukesandberg lukesandberg commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

AsyncModuleLoader::new now filters incoming AvailabilityInfo against the module graph to discard irrelevant entries (same for ManifestAsyncLoader)

This enables more cross route sharing of loader modules addressing part of #97802

It is also expensive, but less expensive than duplicate chunking so for at least the target repo it is a massive win

@lukesandberg
lukesandberg added this pull request to stack #98548 September 13, 2026 15:41
@github-actions

github-actions Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Failing test suites

Commit: b1a69fa | About building and testing Next.js

pnpm test-dev-turbo test/development/app-dir/lazy-dynamic-imports/lazy-dynamic-imports.test.ts (turbopack) (job)

  • lazy-dynamic-imports > does not parse a dynamic import target before activation (DD)
Expand output

● lazy-dynamic-imports › does not parse a dynamic import target before activation

expect(received).toContain(expected) // indexOf

Matcher error: received value must not be null nor undefined

Received has value: null

  257 |         await browser.elementByCss('#load-parse-error').click()
  258 |         await waitForRedbox(browser)
> 259 |         expect(await getRedboxSource(browser)).toContain(
      |                                                ^
  260 |           'parse-error-proves-target-was-analyzed'
  261 |         )
  262 |       } finally {

  at Object.toContain (development/app-dir/lazy-dynamic-imports/lazy-dynamic-imports.test.ts:259:48)

Other failing CI jobs

Move the async-chunk-group availability filter into turbopack-core as
`availability_info_for_async_chunk_group`, and use it from both
`AsyncLoaderModule::new` and `ManifestAsyncModule::new`.

`ManifestAsyncModule` has the same problem `AsyncLoaderModule` had: it is
keyed by the full availability of whichever parent reached it, so a target
imported from many entries gets one copy per entry even when every copy is
byte-identical. On an 8-page fixture with `turbopackLazyDynamicImports`
enabled, the manifest chunk module went from 8 identical copies to 1.
@lukesandberg
lukesandberg force-pushed the async_chunking_availability_explosion branch from 14be686 to b1a69fa Compare September 13, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant