Closed ashi009 closed 4 years ago
As a point of interest, we hit a similar issue and found that webpack-bundle-analyzer
seems to work.
We'd been using source-map-explorer because it is recommended here: https://create-react-app.dev/docs/analyzing-the-bundle-size/
Is this likely the line in question?
Cannot reproduce using typescript@3.7.2 on Windows. @ashi009, is it reproducible only on 3.8.0?
Okay, managed to reproduce it after using correct linebreak when splitting lines
I guess Window's CRLF won't make a difference in the source map. However, as source map explorer splits on LF for the source code, which means CR is counted as the extra character at the line end 🤷♂ and makes the source map valid?
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
facing same issue
Got the same error.
Your source map refers to generated column 48 on line 7, but the source only contains 47 column(s) on that line.
Check that you are using the correct source map.
Any update? Will use webpack
instead of tsc
fix this?
Reproduce
test.js
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.