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

[BUG] Sourcemaps off by 1 line #856

Open
2 of 3 tasks
bot101 opened this issue Jan 4, 2024 · 3 comments
Open
2 of 3 tasks

[BUG] Sourcemaps off by 1 line #856

bot101 opened this issue Jan 4, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@bot101
Copy link

bot101 commented Jan 4, 2024

What happened?

While debugging extensions in Chrome Devtools, the sourcemaps in content scripts are off by one line. I have this experience working on 2 different extensions. In the screenshot, the breakpoint on line 55 actually activates for line 54, and the debug cursor is currently acting on line 55. Is there a fix for this issue?

image

Version

Latest

What OS are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

(OPTIONAL) Contribution

  • I would like to fix this BUG via a PR

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.
@bot101 bot101 added the bug Something isn't working label Jan 4, 2024
@lionelhorn
Copy link

I made a simple test case using example "with-content-scripts-ui"

image

Green arrows shows the same comment in code.
But the mapping from generated file to original source is wrong.
Line 7 in code is mapped to something else. As indicated with the red arrow.

Using https://sokra.github.io/source-map-visualization/#custom as a viewer.

Test file used.

// 

console.log("line 3")



// Comment on line 7

function a() {
	return "line 10"
}

console.log("line 13" +
	" & 14")


export const z = {line: "17 EOF"}

@lionelhorn
Copy link

Using this tool https://evanw.github.io/source-map-visualization/ issue is even clearer.

image

@Nintynuts
Copy link

Nintynuts commented Mar 24, 2024

I've also run into this issue, verified it with the visualization tool, and it's making debugging impossible. I searched for this issue on the web generally, and it seems like something that other people have encountered years ago, but it's unclear whether a fix was found as the issues usually go stale. I presume that plasmo gets this functionality from somewhere else (maybe webpack, but I'm not sure if webpack then gets it from somewhere else), so I guess it needs fixing there and then plasmo would need to update its dependencies?

I really hope this can be fixed soon, because it's my only issue with Plamo. Everything else has been great.

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

No branches or pull requests

3 participants