Skip to content
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 incorrect line number #101

Closed
4 tasks done
paradox37 opened this issue May 9, 2023 · 4 comments · Fixed by #113
Closed
4 tasks done

Sourcemaps incorrect line number #101

paradox37 opened this issue May 9, 2023 · 4 comments · Fixed by #113
Labels
bug Something isn't working released on @next

Comments

@paradox37
Copy link

paradox37 commented May 9, 2023

Describe the bug

As soon as I add this plugin to vite config, I get the wrong line number in browser Console in case of console.log or when unexpected error occurs, which is affecting debugging pretty much.

I expect this plugin to does not affect sourcemaps in a way that points to a wrong line. You can see this behavior in stackblitz I provided. I used stackblitz template preset from ViteJs site, and just added this plugin and one console.log.

Also, take a look at screen shot. Console says line 14, but it's actually 7.

Screenshot 2023-05-09 at 14 09 22
Screenshot 2023-05-09 at 14 09 38

Reproduction

https://stackblitz.com/edit/vitejs-vite-hcnpyq?terminal=dev

Steps to reproduce

  • Open stackblitz.
  • Check browser Console
  • Click on the App.tsx:14
  • It goes to line 14 instead of 7.

System Info

Any system, any browser

Used Package Manager

npm

Logs

No response

Validations

@paradox37 paradox37 added the bug Something isn't working label May 9, 2023
@iFaxity
Copy link
Owner

iFaxity commented May 11, 2023

Hi @paradox37, big thanks for the issue.

I'll take a look at this and see what I can come up with.

The issue i feel might be that there is something that the underlying instrumenter is doing wrong (official istanbul-lib-instrument). As it is using babel to analyse the code it might affect the sourcemap as we use the returned sourcemap to match the coverage to the sourcemap.

Thanks!

@kota65535
Copy link
Contributor

Same here. Is there any progress?

@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 5.0.0-rc.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@iFaxity
Copy link
Owner

iFaxity commented Jun 18, 2023

Please try out the new version to see if the fix is working in the pre release. And i will plan a stable release if it gets good responses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released on @next
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants