You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When SWC transforms a nested array, the resulting sourcemap has an off-by-one error where the mapping for the end of one of the arrays points to an invalid location in the source.
I validated this by taking the input code below and running it through this code:
.. and then trying to load the resulting output with source-map-explorer which fails with:
Your source map refers to generated column 7 on line 2, but the source only contains 6 column(s) on that line.
Check that you are using the correct source map.
See also the attached Source Map Visualiser link in the repro.
Input code
vara=[[]];
Config
n/a
Playground link (or link to the minimal reproduction)
Describe the bug
When SWC transforms a nested array, the resulting sourcemap has an off-by-one error where the mapping for the end of one of the arrays points to an invalid location in the source.
I validated this by taking the input code below and running it through this code:
.. and then trying to load the resulting output with
source-map-explorer
which fails with:See also the attached Source Map Visualiser link in the repro.
Input code
Config
n/a
Playground link (or link to the minimal reproduction)
https://evanw.github.io/source-map-visualization/#NTMAdmFyIGEgPSBbCiAgICBbXQpdOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbmRleC5qcy5tYXAxMjcAeyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIjxhbm9uPiJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgYSA9IFtbXV07Il0sIm5hbWVzIjpbImEiXSwibWFwcGluZ3MiOiJBQUFBLElBQUlBLElBQUk7SUFBQyxFQUFFO0NBQUMifQ==
SWC Info output
Expected behavior
The sourcemap will be valid.
Actual behavior
The sourcemap is invalid, the second closing paren is mapped past the end of the line:
Version
1.3.91
Additional context
https://evanw.github.io/source-map-visualization/#NTMAdmFyIGEgPSBbCiAgICBbXQpdOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbmRleC5qcy5tYXAxMjcAeyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIjxhbm9uPiJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgYSA9IFtbXV07Il0sIm5hbWVzIjpbImEiXSwibWFwcGluZ3MiOiJBQUFBLElBQUlBLElBQUk7SUFBQyxFQUFFO0NBQUMifQ==
The text was updated successfully, but these errors were encountered: