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 don't seem to be generated correctly #214

Open
wespickett opened this issue Jun 27, 2023 · 1 comment
Open

Sourcemaps don't seem to be generated correctly #214

wespickett opened this issue Jun 27, 2023 · 1 comment

Comments

@wespickett
Copy link
Contributor

wespickett commented Jun 27, 2023

Tested on a file utils.js with utils.js.map

Then used source-map-explorer utils.js utils.js.map (https://www.npmjs.com/package/source-map-explorer)
And I get this error:

source-map-explorer utils.js utils.js.map       

utils.js
  Your source map refers to generated column 9 on line 9, but the source only contains 1 column(s) on that line.
  Check that you are using the correct source map.

Verified the same result using https://www.npmjs.com/package/source-map with script sm.js

It expects line 9 to be the base64encode line, but base64encode is actually on line 7 in the generated code
image

image
@BinToss
Copy link

BinToss commented Jan 17, 2025

Using Packemon's experimental SWC compiler, the sourcemaps are correct...at first glance. I seem to only experience incorrect source maps when using the default Babel toolchain.

Edit: swc isn't right, either, according to source-map-explorer. But, in practice, it's more accurate than Babel's output; good enough for debugging.

npx source-map-explorer .\mjs\utils\reflection.mjs .\mjs\utils\reflection.mjs.map

Babel:

Your source map refers to generated column 229 on line 10, but the source only contains 228 column(s) on that line.
Check that you are using the correct source map.

Swc:

Your source map refers to generated column 63 on line 22, but the source only contains 62 column(s) on that line.
Check that you are using the correct source map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants