[Flight] Source Map Actions in Reference Node Loader Transforms#30755
Merged
sebmarkbage merged 4 commits intofacebook:mainfrom Aug 21, 2024
Merged
[Flight] Source Map Actions in Reference Node Loader Transforms#30755sebmarkbage merged 4 commits intofacebook:mainfrom
sebmarkbage merged 4 commits intofacebook:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
So we can use this to generate source maps that point to original code.
Which is a dependency of webpack which is already a peer.
This lets the generated server references point to the original function declaration (or export declaration if an identifier is exported).
613e23e to
b3da2c2
Compare
eps1lon
approved these changes
Aug 21, 2024
| "react-dev-utils": "^12.0.1", | ||
| "react-dom": "experimental", | ||
| "react-refresh": "^0.11.0", | ||
| "react-server-dom-webpack": "experimental", |
Collaborator
There was a problem hiding this comment.
Was wondering if we need to update the build-for-flight-dev command but that already builds react-server-dom-webpack
Contributor
Author
There was a problem hiding this comment.
This was previously just copied into the folder but that didn't make yarn consider its dependencies when resolving dependencies.
eps1lon
added a commit
to vercel/next.js
that referenced
this pull request
Aug 23, 2024
**breaking change for canary users: Bumps peer dependency of React from `19.0.0-rc-1eaccd82-20240816` to `19.0.0-rc-eb3ad065-20240822`** No changes required in Next.js it seems. [diff facebook/react@1eaccd82...eb3ad065](facebook/react@1eaccd8...eb3ad06) <details> <summary>React upstream changes</summary> - facebook/react#30761 - facebook/react#30779 - facebook/react#30775 - facebook/react#30770 - facebook/react#30756 - facebook/react#30755 - facebook/react#30768 - facebook/react#30760 - facebook/react#30732 - facebook/react#30757 - facebook/react#30750 - facebook/react#30751 - facebook/react#30753 - facebook/react#30740 - facebook/react#30748 - facebook/react#30746 - facebook/react#30747 - facebook/react#30731 - facebook/react#30725 - facebook/react#30741 - facebook/react#30730 - facebook/react#30726 - facebook/react#30717 - facebook/react#30729 - facebook/react#30721 - facebook/react#30720 - facebook/react#30705 </details>
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.
Follow up to #30741.
This is just for the reference Webpack implementation.
If there is a source map associated with a Node ESM loader, we generate new source map entries for every
registerServerReferencecall.To avoid messing too much with it, this doesn't rewrite the original mappings. It just reads them while finding each of the exports in the original mappings. We need to read all since whatever we append at the end is relative. Then we just generate new appended entries at the end.
For the location I picked the location of the local name identifier. Since that's the name of the function and that gives us a source map name index. It means it jumps to the name rather than the beginning of the function declaration. It could be made more clever like finding a local function definition if it is reexported. We could also point to the line/column of the function declaration rather than the identifier but point to the name index of the identifier name.
Now jumping to definition works in the fixture.
Unfortunately this technique doesn't seem to work in Firefox nor Safari. They don't apply the source map for jumping to the definition.