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
Invalid sourcemaps even without any AST changes #12312
Comments
Hey @mischnic! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite." |
Looks like this is related to this function resetting the position after the argument is printed: babel/packages/babel-generator/src/buffer.js Lines 270 to 305 in 3227914
|
fixed in #14967 |
Bug Report
Current behavior
This script parses a file and then stringifies the AST again without changing it:
The bracket after the call arguments is mapped to the start of the line (just like
console
):Input Code
Expected behavior
For example Rollup's output:
Environment
Possible solution
It looks like characters that don't have their own AST node (e.g. brackets) just use the location of their parent node (CallExpression), without accounting for any child nodes that might be between the start of the parent and the character (the callee or the arguments).
Additional context
This might cause invalid sourcemaps with Parcel (after passing Babel's output to other tools).
Repo containing script & artifacts for Babel and Rollup: https://github.com/mischnic/parcel-invalid-sourcemaps
The text was updated successfully, but these errors were encountered: