[Bug]: this.sourceMap
in the LoaderContext is false
when using SourceMapDevToolPlugin
#7952
Labels
bug
Something isn't working
System Info
System:
OS: macOS 14.6.1
CPU: (12) arm64 Apple M2 Max
Memory: 30.78 GB / 96.00 GB
Shell: 3.7.1 - /opt/homebrew/bin/fish
npmPackages:
@rspack/cli: ^1.0.5 => 1.0.5
@rspack/core: ^1.0.5 => 1.0.5
Details
I'm using custom configuration of
SourceMapDevToolPlugin
, both Webpack and Rspack documentation shows that I should setdevtool: false
.But after I set
devtool: false
, I found the source-map is not correctly generated.After dive into the compilation process, I found that is caused by the
this.sourceMap
changes tofalse
in my custom loader.The Rspack directly use
devtool
to setuploaderContext.sourceMap
:rspack/packages/rspack/src/loader-runner/index.ts
Lines 556 to 558 in 2ec06e4
But Webpack will update the value in the
SourceMapDevToolModuleOptionsPlugin
:https://github.com/webpack/webpack/blob/dae16ad11e2d2accddc549a92082da3d2e667b01/lib/SourceMapDevToolModuleOptionsPlugin.js#L31
Reproduce link
https://github.com/colinaaa-reproductions/rspack-loader-context-sourcemap
Reproduce Steps
pnpm install
pnpm build:webpack
node webpack-dist/main.js
// showtrue
pnpm build:rspack
node rspack-dist/main.js
// showfalse
The text was updated successfully, but these errors were encountered: