-
Notifications
You must be signed in to change notification settings - Fork 103
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
Report InvalidMappingColumn on tsc generated source map #136
Comments
As a point of interest, we hit a similar issue and found that 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? source-map-explorer/src/explore.ts Line 109 in c007f36
|
Cannot reproduce using typescript@3.7.2 on Windows. 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? |
- Detect EOL character for the file. It fixes wrong splitting for source maps generated on Windows environments. - When checking column boundary verify that the last referenced column is not EOL. - Generate source map referencing EOL characters (typescript.ts) - Fix 'InvalidMappingLine' check. Getting not existing value from array returns `undefined`, not `null`. - Add test for 'InvalidMappingColumn' error. Generate `invalid-map-column.js` and `invalid-map-line.js`.
- Detect EOL character for the file. It fixes wrong splitting for source maps generated on Windows environments. - When checking column boundary verify that the last referenced column is not EOL. - Generate source map referencing EOL characters (typescript.ts) - Fix 'InvalidMappingLine' check. Getting not existing value from array returns `undefined`, not `null`. - Add test for 'InvalidMappingColumn' error. Generate `invalid-map-column.js` and `invalid-map-line.js`. - Fix tests for errors - Use `/` as invalid filename - works on Linux/Windows
- Remove useless false-positive check for source map referencing EOL. Creating string with the length of the file on each iteration greatly decrease performance - Disable check for invalid mapping column until #136 is fixed - Update `InvalidMappingColumn` error message - add 1 to `generatedColumn` to count columns from 1 to conform with `contains ${maxColumn} column(s)` phrase - Reduce usage of `map-reference-eol.js` in tests - Generate `invalid-map-column.js` and `invalid-map-line.js` without `tsc` to eliminate source map referencing EOL
- Remove useless false-positive check for source map referencing EOL. Creating string with the length of the file on each iteration greatly decrease performance - Disable check for invalid mapping column until #136 is fixed - Update `InvalidMappingColumn` error message - add 1 to `generatedColumn` to count columns from 1 to conform with `contains ${maxColumn} column(s)` phrase - Reduce usage of `map-reference-eol.js` in tests - Generate `invalid-map-column.js` and `invalid-map-line.js` without `tsc` to eliminate source map referencing EOL
- Get source content to detect mapping reference EOL. This will only work if the source map has `sourcesContent`. We can implement remote sources support later. - Cache "is referencing EOL" check per source. - Update `map-reference-eol.js` to address some edge cases.
- Get source content to detect mapping reference EOL. This will only work if the source map has `sourcesContent`. We can implement remote sources support later. - Cache "is referencing EOL" check per source. - Update `map-reference-eol.js` to address some edge cases.
Got
Ubuntu 20, source-map-explorer@2.5.0 |
facing same issue |
Got the same error.
Any update? Will use |
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 microsoft/TypeScript#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.
The text was updated successfully, but these errors were encountered: