-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
@swc/core version 1.3.4 and later is generating invalid sourcemaps when webpack + swc-loader used #6244
Comments
**Related issue:** - Closes #4578. - Closes #6244. - vercel/next.js#39878. Co-authored-by: Justin Ridgewell <[email protected]>
@kdy1 it doesn't seem like this was fixed with the latest version of swc/core + swc-loader? |
Seems like #5657 is the cause |
Investigation: The problem is that the new source map has |
I concluded that this is not a bug of swc. Dumped source map using https://pastcompute.github.io/ScriptMapper/
As you can see, mappings are correct. (i.e. It does not have two Additionally, by using dbg!()
|
I'll close this issue with a PR adding tests |
Additionally, to help error reporting to webpack, this is the wrong, final source map.
The problem is
but this is not generated by swc. |
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. |
Describe the bug
Sample project working with
@swc/core
v1.3.3
: https://github.com/shiftkey/swc-ts-webpack-sourcemap-reproThese steps use different tools for validating the sourcemap file on disk to ensure we don't ship malformed sourcemaps to the browser.
old
uses https://www.npmjs.com/package/sourcemap-validator andnew
uses https://www.npmjs.com/package/source-map.But since
@swc/[email protected]
or later the generated sourcemaps are no longer valid:I've also attached testing the
swc
command line tool which is valid for both cases:Input code
See attached repository for small React application.
src/app.tsx
src/index.tsx
Config
Playground link
No response
Expected behavior
Generated sourcemaps after bundling do not have invalid mappings
Actual behavior
Output from
npm run webpack:old
with updated@swc/core
:Output from
npm run webpack:new
with updated@swc/core
:Version
@swc/core 1.3.4 or later
Additional context
No response
The text was updated successfully, but these errors were encountered: