question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Report InvalidMappingColumn on tsc generated source map

See original GitHub issue

Reproduce

$ source-map-explorer test.js
test.js
  Your source map refers to generated column 21 on line 1, but the source only contains 21 column(s) on that line.
  Check that you are using the correct source map.

test.js

console.log('hello');
console.log('world');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUNyQixPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDIn0=

Root cause

Typescript emits mappings for end-of-line characters, which breaks the boundary checks in source-map-explorer.

This issue has been reported as https://github.com/microsoft/TypeScript/issues/34695. However, even if it’s fixed in next ts release, there will be code generated by earlier versions of tsc around, that source-map-explorer won’t be able to process.

Moreover, though it doesn’t seem to be an ordinary input to source-map-explorer, such mapping can easily propagate its way to the final bundle and breaks source-map-explorer eventually.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

6reactions
Fi1osofcommented, Nov 13, 2020

Got

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

Ubuntu 20, source-map-explorer@2.5.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

sourceMap - TypeScript: TSConfig Option
How this setting affects your build.
Read more >
source-map-explorer: Versions - Openbase
Full version history for source-map-explorer including change logs. ... #136 Report InvalidMappingColumn on tsc generated source map. Internal.
Read more >
Troubleshooting Source Maps for JavaScript
Source maps can sometimes be tricky to get going. If you're having trouble, you can try using our verification tool inside sentry-cli ,...
Read more >
Using Source Maps - Javascript Honeybadger Documentation
The best way to let us know about your source map is to upload your files to our servers every ... Most modern...
Read more >
No source maps files in release mode - Stack Overflow
The Visual Studio "TypeScript Build" section has a checkbox for "Generate source maps" that is tied to the build configuration. Also tsc has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found