-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Sourcemap shifting with multiline template strings in jest #2185
Comments
Looks like this is indeed an issue with swc, it also messes up sourcemaps for source-map-support with TypeScript. The same thing also happens with multi-line comments: /**
* This is a
* long
* license
* header
*/
console.log(new Error().stack) Some findings:
{
"module": {
"type":"commonjs"
},
"exclude":[".*.js$",".*\\.d.ts$"],
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": false,
"decorators": true,
"dynamicImport": true
},
"target":"es2016",
},
"sourceMaps": true
} |
kdy1
added a commit
that referenced
this issue
Dec 10, 2021
This was referenced Dec 11, 2021
nicholasxjy
pushed a commit
to nicholasxjy/swc
that referenced
this issue
Dec 18, 2021
swc_ecma_codegen: - Handle source map of multi-line template literals. (Closes swc-project#2185, Closes swc-project#2362, Closes swc-project#2900)
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
The sourcemap has shifting when testing in jest with multiline template strings. This problem will disappear after removing
target
option in swcrc.See the screenshot below:
However, I cannot reproduce if I use swc cli directly. Everything seems be fine when I upload the source and the sourcemap to source-map-visualization. I have no idea whether this issue is related to jest or swc.
Input code
https://github.com/hjkcai/jest-swc-source-map-shifting
Config
Expected behavior
The sourcemap correctly maps back to the source.
Version
The version of @swc/core: latest (1.2.83)
The text was updated successfully, but these errors were encountered: