Open cjnoname opened 1 month ago
please provide rspack version
please provide rspack version
1.0.5 the latest
please provide rspack version
I could send you the buggy soucemap files and mjs files via email or whatever tools but I don't want to share them with public.
I think this is the same issue as https://github.com/web-infra-dev/rsbuild/issues/3433 we found that source map stopped generated properly since 1.0.1 version (probably after https://github.com/web-infra-dev/rspack/pull/7647). @cjnoname, you can try the 1.0.0 version of rspack to identify when it was broken.
I think this is the same issue as web-infra-dev/rsbuild#3433 we found that source map stopped generated properly since 1.0.1 version (probably after #7647). @cjnoname, you can try the 1.0.0 version of rspack to identify when it was broken.
Apologies, I haven't had time to test it with version 1.0.1, but I’m quite sure it was working before when I tested it.
@hardfist
This is a significant issue since Sentry is the primary monitoring tool for many companies, and I hope someone can assist in looking into it.
Verifying the issue is straightforward - a single command line should work:
npx source-map-explorer index.mjs index.mjs.map
Hello @cjnoname, sorry we can't investigate the problem further without reproduction demo, please provide a repro demo by forking rspack-repro, or provide a minimal GitHub repository by yourself. Issues labeled by need reproduction
will be closed if no activities in 14 days.
@hardfist
This is a significant issue since Sentry is the primary monitoring tool for many companies, and I hope someone can assist in looking into it.
Verifying the issue is straightforward - a single command line should work:
npx source-map-explorer index.mjs index.mjs.map
@cjnoname I can't investigate more without any reproductions, maybe you should try upgrade to 1.0.5 to see whether the sourcemap problem is solved
@hardfist This is a significant issue since Sentry is the primary monitoring tool for many companies, and I hope someone can assist in looking into it. Verifying the issue is straightforward - a single command line should work: npx source-map-explorer index.mjs index.mjs.map
@cjnoname I can't investigate more without any reproductions, maybe you should try upgrade to 1.0.5 to see whether the sourcemap problem is solved
https://github.com/cjnoname/rspack-reproduce
You can find the issue with a simple command: "npm run s".
I am not sure if this is the only issue causing the sourcemap to break, or if there might be other issues as well.
maybe you should try upgrade to 1.0.5 to see whether the sourcemap problem is solved
Hey hi, guys 👋
Would like to confirm that the latest v1.0.5 has a broken source map.
We upgraded from 0.7.5 to 1.0.3 and noticed an issue with the broken source-map - there is a big % of [no source]
code based on source-map-explorer
package analysis.
(NOTE: you need to run the package with --no-border-checks
key to process the broken source maps completely, e.g: npx source-map-explorer --no-border-checks ./dist
)
So we downgraded all @rspack
packages to stable v1.0.0
@yuzhva @cjnoname sorry for the inconvenience and reproduction, confirmed it's a bug we are gonna fix it ASAP.
@yuzhva @cjnoname sorry for the inconvenience and reproduction, confirmed it's a bug we are gonna fix it ASAP.
I’ve put together a minimal reproduction repository last night. While I haven't done something exactly like this before, it should accurately represent the issue.
https://github.com/cjnoname/rspack-reproduce
run "npm run s" can present this issue.
Not sure if it's the only issue on sourcemap or not.
I am currently investigating this issue.
@cjnoname Currently, it looks like the issue with the source map is caused by the swc
minifier. Please use the Terser Webpack Plugin to handle code minification first.
If the issue persists, there may be other factors causing the source map generation error. Please provide additional repos to reproduce the problem.
In this repository, you can observe that the source maps generated by SWC cause errors in source-map-explorer. https://github.com/SyMind/swc-minifier-source-map-bug
In this repository, you can observe that the source maps generated by SWC cause errors in source-map-explorer. https://github.com/SyMind/swc-minifier-source-map-bug
Thank you for investigating this issue. I understand that the SWC minifier is also maintained by your team, correct?
Could you let us know if there are any plans to address this issue in the near future? We are willing to wait a few days if necessary.
We are experiencing poor performance with the Terser Webpack Plugin, which we would prefer not to revert to.
Do you have an estimated timeline for a fix?
Thanks
@cjnoname I'm not certain if the issue is actually caused by the SWC minifier. Could you please try using the Terser Webpack Plugin and see if the problem persists?
@yuzhva Please provide the a demo to reproduce the issue.
@cjnoname I'm not certain if the issue is actually caused by the SWC minifier. Could you please try using the Terser Webpack Plugin and see if the problem persists?
The issue persists even after I turned off the minimizer and disabled output: module. It still occurs. You can easily check it in my repo by adjusting the rspack.config.js file.
@cjnoname Please don't turn off the minimizer. I've tried this before, and I found that some modules in node_modules
have source map comments. This causes source-map-explorer
to throw errors.
@cjnoname You can see the code in source-map-explorer here: https://github.com/danvk/source-map-explorer/blob/master/src/lib/explore.ts#L208
@cjnoname You can see the code in source-map-explorer here: https://github.com/danvk/source-map-explorer/blob/master/src/lib/explore.ts#L208
It works, but it's running much slower than before. Could you help me report this issue to SWC?
@cjnoname Yes. If you can confirm that the issue is caused by the SWC minifier, I will continue to work on it.
@cjnoname Yes. If you can confirm that the issue is caused by the SWC minifier, I will continue to work on it.
Yeah... Terser Webpack Plugin works fine for now. Please go ahead.
Here is a fork with an example for source-map "investigation": https://github.com/yuzhva/rspack-repro/commit/7ad443cc0f37d86244fd9ca18eb4cb646fe7e063
I just forked the original repo https://github.com/web-infra-dev/rspack-repro
and enabled the source map for rsbuild.config.ts
and rspack.config.mjs
configs:
I will prepare the same ones for v.1.0.0 if I would be able to find some spare time today.
@SyMind cc: @cjnoname
swc
minifiyer.🔴 Our current configuration that does not work:
const { SwcJsMinimizerRspackPlugin } = require('@rspack/core');
optimization: {
minimize: true,
minimizer: [new SwcJsMinimizerRspackPlugin()],
},
🟢 There are few options that you can use to make it work:
Source Map works with one of the next configs:
either disable minification:
optimization: {
minimize: false,
},
or pass empty array as minimizer
key for config:
optimization: {
minimize: true,
minimizer: [],
},
Use Terser Webpack Plugin for minimication:
const TerserPlugin = require("terser-webpack-plugin");
optimization: { minimize: true, minimizer: [new TerserPlugin()], },
The Terser covers 100% of the source map, but it is very slow.
---
UPD: The `'swc-minify-webpack-plugin'` - gives the same results as `SwcJsMinimizerRspackPlugin` with a lot of broken source-map
same here
Looks like SWC fixed the issue, thanks @SyMind for posting it there! Out of curiosity, how does the rsbuild release process look like for downstream dependency updates (such as SWC)?
Looks like SWC fixed the issue, thanks @SyMind for posting it there! Out of curiosity, how does the rsbuild release process look like for downstream dependency updates (such as SWC)?
normally we bump swc version in minor release, but if it contains hotfix bug, we may release early
@SyMind SWC has released the new version including the fix mate :)
Looks like SWC fixed the issue, thanks @SyMind for posting it there! Out of curiosity, how does the rsbuild release process look like for downstream dependency updates (such as SWC)?
normally we bump swc version in minor release, but if it contains hotfix bug, we may release early
Any plan to release a new version soon?
@cjnoname it's already available in 1.0.7
@cjnoname it's already available in
1.0.7
Nope
Ouch. You're right. My B.
Seems like this SWC version is buggy
Seems like this SWC version is buggy
@cjnoname Thanks for your reminder 🌹 . Rspack currently does not use the functions related to this issue. If there are any problems in the future, we will follow up in time.
And it's already available in 1.0.8.
Seems like this SWC version is buggy
@cjnoname Thanks for your reminder 🌹 . Rspack currently does not use the functions related to this issue. If there are any problems in the future, we will follow up in time.
And it's already available in 1.0.8.
This is awesome. Much appreciated!
Hey @hardfist @SyMind,
It’s still not working for us due to a different issue. Please refer to the same repository to reproduce the problem.
https://github.com/cjnoname/rspack-reproduce
Thank you!
1.0.8
1.0.8
devtool: 'source-map'
I can confirm the issue is still there in 1.0.10
. Just like before, source-map
is broken (in many sourcemap ranges), cheap-module-source-map
works fine—breaking the use of any tools such as Sentry, Datadog, etc. to analyze errors in production and making it hard (or impossible) to debug production issues. I see the issue is being discussed in other threads (e.g., https://github.com/web-infra-dev/rspack/issues/8021), is there an official issue tracking this bug and do we know if it's SWC or rspack/rsbuild-related? Is there any workaround besides downgrading to Rspack 1.0.0
? Thanks!
This is actually a serious bug that prevents people from using Rspack normally. I hope someone can fix it soon so Rspack can return to normal use.
Today, I checked and found that the issue with SWC still exists. Previously, I upgraded SWC and did some local testing. It might be because I modified the source-map-explorer
code, which led me to mistakenly believe that the issue with SWC had been fixed.
I will continue working to resolve this issue.
Today, I checked and found that the issue with SWC still exists. Previously, I upgraded SWC and did some local testing. It might be because I modified the
source-map-explorer
code, which led me to mistakenly believe that the issue with SWC had been fixed.I will continue working to resolve this issue.
Thanks for fixing the previous issue with Sentry package—it worked as expected. However, there's a different issue with some other packages that I'm quite certain about. I'm also a bit concerned there might be additional issues now that the original one has been resolved.
The issue can be reproduced within the same repository. https://github.com/cjnoname/rspack-reproduce
Thank you!
@cjnoname I've released a canary version of Rspack 1.0.9-canary-5f4b3e7d-20241010033454
. Could you please verify if it works correctly? Thank you!
@cjnoname I've released a canary version of Rspack
1.0.9-canary-5f4b3e7d-20241010033454
. Could you please verify if it works correctly? Thank you!
Hey mate, I could not find your version
@cjnoname Please use the following package to replace @rspack/core
: https://www.npmjs.com/package/@rspack/core-canary/v/1.0.9-canary-5f4b3e7d-20241010033454. Update your dependencies as shown below:
"@rspack/core": "npm:@rspack/core-canary@1.0.9-canary-5f4b3e7d-20241010033454"
@cjnoname Please use the following package to replace
@rspack/core
: https://www.npmjs.com/package/@rspack/core-canary/v/1.0.9-canary-5f4b3e7d-20241010033454. Update your dependencies as shown below:"@rspack/core": "npm:@rspack/core-canary@1.0.9-canary-5f4b3e7d-20241010033454"
It works mate, thank you
@SyMind what about us folks using Rsbuild 👼 ? Will this be included in the next release?
This change is included in rsbuild@1.0.12
, right? (I see it includes rspack@1.0.9
). For what is worth, it's still not working for us 😿
Ton of sourcemaps area are unreachable and can't be debugger. Downgrading Rsbuild (a lot) fixes it. I'll try to investigate a bit more, but I'm a bit lost at the moment.
System Info
System: OS: macOS 15.0 CPU: (10) arm64 Apple M1 Max Memory: 2.03 GB / 64.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.8.0 - ~/.nvm/versions/node/v22.8.0/bin/node npm: 10.8.3 - ~/.nvm/versions/node/v22.8.0/bin/npm bun: 1.1.27 - /usr/local/bin/bun Browsers: Chrome: 128.0.6613.138 Safari: 18.0
Details
The source maps stopped working on Sentry. After discussing with their team, we identified that the issue was caused by an invalid source map generated by Rspack.
When testing the source map with source-map-explorer or other tools, the following error appeared:
'Your source map refers to generated column 53099 on line 39, but the source only contains 53098 columns on that line. Please verify that you are using the correct source map.'
Approximately 70% of the source map files we tested are working, while 30% have failed.
Reproduce link
No response
Reproduce Steps
https://github.com/cjnoname/rspack-reproduce
npm run s