[pull] canary from vercel:canary#135
Merged
Merged
Conversation
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!)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 : )