Ingesting a sourcemap containing blank/unmapped files leads to inaccurate sourcemap output. (T7583) #4474
Labels
area: sourcemaps
i: bug
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
Bug information
Description
Using the inputSourceMap option, providing a mapping which contains files with no corresponding line mappings will produce a sourcemap with mappings offset by the number of blank files.
A repo which demonstrates the problem can be seen here: WeaveTeam/blank-file-bug. I've attempted to make the test-case as minimal as possible. In addition to the dependencies listed, you'll also need to install node-debug globally to easily test it, or other sourcemap-enabled Node debugger.
Steps to reproduce:
Result:
No breakpoint will be set.
You can get the expected behavior from bin/es6/main.js, as the code provided contains no ES6-isms and can run without crosscompilation. By performing the above steps, you can confirm that the input sourcemaps generated by typescript are correct.
An examination of the two main.js.map files reveals the problem; in the babel output, all the 'mappings' have a 0 ('A') source file offset, therefore pointing to the first (blank) entry in the sources list, which is not accurate, while in the input generated by Typescript, the first mapping contains a source offset of 2 ('C')
References:
Source Map Revision 3 Proposal
The text was updated successfully, but these errors were encountered: