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
Sourcemaps stop working due to multiline comment + CRLF line endings #32470
Comments
I'm not really sure what the bug is, I cannot reproduce what you are describing (eg.: I always get what you are describing on the second image). As a note, the |
@balazsorban44 Hmm which browser and OS are you using? And are you using my repository? Because I can imagine that without TypeScript, you won't have this problem. I'm aware that having it in the Edit: On another Windows PC with Chrome I can't reproduce it either.. Really weird, because on my own PC with a clean clone of my test repository, I can reproduce it everytime, even on Firefox.. |
@balazsorban44 When changing the linefeed from CRLF to LF and trying again, the issue is resolved. So it seems to be a bug when combining CRLF with multiline comments. Can you try if you can reproduce it with CRLF linefeeds enabled in We can use this as a workaround but I feel like this bug should also be fixed, because it's very hard to debug when you run into this issue.. I think CRLF is the default on Git on Windows because CRLF is the native line ending on Windows. |
I am on Linux, and I used your reproduction. You are correct though, I could reproduce it by changing the line ending to CRLF and resave the It happens when using the SWC transform. |
I think this might possibly be fixed in swc-project/swc#3023, which has been released in swc_ecma_codegen 0.83.2. |
## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint` This applies - swc-project/swc#3051 Fixes #32553 - swc-project/swc#3023 Fixes #32470
@balazsorban44 Unfortunately, this issue wasn't fixed by #32566. |
## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint` This applies - swc-project/swc#3051 Fixes vercel#32553 - swc-project/swc#3023 Fixes vercel#32470
I also experienced the issue with line ending CRLF breaking my Vscode debugger and resulting in breakpoints jumping and "old code" in the debugger. I only experienced this in server side Nextjs code. When I changed the line ending of this file (of the imported function) to CRLF to LF, everything worked normally. I used the following versions:
And the default launch script for vscode from the Nextjs docs. |
@prometixX Can you try updating next? |
Its really strange, right now I cant replicate the problem anymore, but I did not update. If this debugging issue occurs again, I will check if LF line endings fixes it again, but for now I cant replicate it anymore. |
Can someone provide a repro? I think this is fixed by swc-project/swc@26a0c13 |
@kdy1 Sorry for the late response, I updated Next.js and React to the latest version in my reproduction repository and the problem is resolved: |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
Happens in at least 12.0.0, 12.0.7, 12.0.8-canary.5 and 12.0.8-canary.8.
What version of Node.js are you using?
16.13.1
What browser are you using?
Chrome
What operating system are you using?
Windows
How are you deploying your application?
next dev
Describe the Bug
When my function has a multiline comment, sourcemaps break.
I can't set a breakpoint on the first
console.log
and the variables in "Scope" make no sense:Expected Behavior
I expected the same behavior as when the multiline comment is removed, so being able to set a breakpoint on the first
console.log
and the "Scope" looking like this:To Reproduce
npx create-next-app@latest --ts
)yarn
to install the dependenciesyarn dev
to start Next.js in developmentLogSomeText.ts
You can see that when you completely remove the multiline comment in
LogSomeText.ts
, you can set a breakpoint on the firstconsole.log
again and the variables in the scope make sense again.The text was updated successfully, but these errors were encountered: