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
Nested arrays cause off-by-one error in generated sourcemaps #8066
Comments
Oops. It seems like we need to add some more domains to allowlist. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: