-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix react-refresh source maps #12686
Fix react-refresh source maps #12686
Conversation
I propose another solution: put the react refresh header in a single line, then remove the first new line of the file. This way only the first line sourcemaps will be wrong, which shouldn’t matter anyway because it only contains imports. this technique is already used by Vite for other transformations, it lets you skip parsing one more time with Babel which is expensive |
This reverts commit d3ebdcc.
🦋 Changeset detectedLatest commit: b35ddb1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
@remorses thanks for suggestion - the output isn't as pretty, but the code is much simpler, and the source maps are even better since the first line of code comes from react-refresh and was already unmapped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've run this locally and confirmed it works. Thanks for the PR 🙏
🤖 Hello there, We just published version Thanks! |
Resolves #12483
The
react-router:react-refresh-babel
transform was wrapping the code with big chunks of code that completely threw off the source maps. I've changed the wrapping code to use babel to maintain the source maps, and split it off into a new transform step so the source maps from the previous transform flow through.