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

Fix column offsets for source mapped code #197

Merged
merged 3 commits into from
Aug 2, 2021
Merged

Fix column offsets for source mapped code #197

merged 3 commits into from
Aug 2, 2021

Conversation

calebeby
Copy link
Member

@calebeby calebeby commented Aug 2, 2021

Closes #189

The problem was, the column offsets were off-by-one when esbuild was disabled, but they were fine when esbuild was enabled.

Something like this:

console.log(nothing)
             ^ ReferenceError: nothing is not defined

The reason for this ended up being that the source-map library uses zero-indexed columns, while almost everything else uses 1-indexed columns. Once I found this out it was easy to fix.

Along the way, I found out that @rollup/plugin-babel doesn't work, so I fixed it (the plugin required that the options hook got called, so I added the options hook to our fake rollup). I think it is important for this plugin to work since it will probably be pretty common for people to a specific babel setup that can't be replaced with esbuild

The tests cover both changes ✅

@calebeby calebeby merged commit 537fbef into main Aug 2, 2021
@calebeby calebeby deleted the column-offsets branch August 2, 2021 21:26
@github-actions github-actions bot mentioned this pull request Aug 2, 2021
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

Successfully merging this pull request may close these issues.

When esbuild is disabled, runJS runtime thrown source-mapped error column is off-by-one
2 participants