web-infra-dev / rspack

The fast Rust-based web bundler with webpack-compatible API 🦀️
https://rspack.dev
MIT License
9.33k stars 544 forks source link

[Bug]: ConcatenateModules optimization affect on sourcemaps #6709

Closed mrakobes27 closed 2 months ago

mrakobes27 commented 4 months ago

System Info

System:
OS: Windows 10 10.0.19044
CPU: (8) x64 AMD Ryzen 7 5700G with Radeon Graphics
Memory: 8.30 GB / 19.52 GB
Binaries:
Node: 18.19.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (123.0.2420.97)
Internet Explorer: 11.0.19041.1566
npmPackages:
@rspack/cli: 0.6.5 => 0.6.5
@rspack/core: 0.6.5 => 0.6.5
@rspack/plugin-minify: 0.6.5 => 0.6.5 @rspack/plugin-react-refresh: 0.6.5 => 0.6.5

Details

When enabled "concatenateModules" optimization "sourcemaps" are broken (offsets of original sourcemaps of concatenated js-modules are not recalculated).

When disabling this optimization, the sourcemaps are generated correctly (I checked it through the sourcemaps visualizer - https://sokra.github.io/source-map-visualization/#custom)

Reproduce link

No response

Reproduce Steps

sourcemapsBug In the source code where you can check the operation of the "concatenateModules" optimization, try to enable/disable this option, and make sure that in one case the "sourcemaps" are formed correctly, and in the other they are not (including the impossibility of setting a breakpoint)

mrakobes27 commented 4 months ago

Moreover, even if the "concatenation" is performed on one module (out of many existing ones), the source maps are broken for all subsequent code in the bundle.

JSerFeng commented 3 months ago

Can you give me a reproduce repo ? I tried a easy demo seems fine here:

image

github-actions[bot] commented 3 months ago

Hello @mrakobes27, 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.

SyMind commented 3 months ago

@mrakobes27 @JSerFeng Maybe fixed in https://github.com/web-infra-dev/rspack/issues/6793

github-actions[bot] commented 2 months ago

Since the issue was labeled with need reproduction, but no response in 14 days. This issue will be closed. Feel free to comment and reopen it if you have any further questions.