Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

pull[bot]
Copy link

@pull pull bot commented May 17, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

Dynamic import tracking should never be applied to edge runtime code,
because:
1. `dynamicIO` prerendering is not supported for edge
2. the implementation of `dynamicIO` prerendering relies on
node-specific APIs.

I missed this in #74152. This PR fixes a couple things:
- We no longer apply the dynamic import tracking to any edge modules
- Just to be safe, `trackDynamicImport` and `new CacheSignal` will now
throw if it's called from the edge runtime
- However, if `track-module-loading` does end up in an edge module, we
don't want to error at the top-level when creating
`moduleLoadingSignal`, so it is now initialized lazily. This is a bit
ugly, but `AppRouteRouteModule` currently pulls all prerendering-related
code in at the top level (instead of e.g. a conditional `require()` when
prerendering), so it *is* included in edge route handlers, even if
unused.
- this also required changing `__next_require__`/`__next_chunk_load__`
to only track module loading in DIO prerenders, otherwise we'd attempt
to create `moduleLoadingSignal` in edge RSC too

I also fixed a potential unhandled rejection in `CacheSignal.trackRead`,
because `.finally` rejects even if the original error was caught
somewhere else. (thanks for finding this one @gnoff!)
@pull pull bot added the ⤵️ pull label May 17, 2025
@pull pull bot merged commit f270834 into code:canary May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant