Bug Description
When I either set a devtool config value to hidden-source-map-debugids or use a webpack.SourceMapDevToolPlugin with a configuration matching hidden-source-map-debugids, the debug ID appended to the generated .js file is corrupted – it looks like //# debugId=<hash>false instead of //debugId=<hash>.
Link to Minimal Reproduction and step to reproduce
https://github.com/in-doge-we-trust/webpack-debugids-append-issue-repro
Case #1 (webpack.SourceMapDevToolPlugin is used manually) steps:
- Run
npm install
- Run
npm run build
Case #2 (devtool set to hidden-source-map-debugids) steps:
- Run
npm run clear (optional)
- Run
npm run build
Expected Behavior
debugId value in the source-map file matches the value in //# debugId=<hash> comment appended to the generated .js.
Actual Behavior
debugId value in the source-map file is correct, while //# debugId=<hash> comment has false appended to the end and looks like this – //# debugId=<hash>false.
Environment
Binaries:
Node: 22.18.0
npm: 10.9.3
Packages:
webpack: 5.102.1 => 5.102.1
webpack-cli: 6.0.1 => 6.0.1
Is this a regression?
No
Last Working Version
No response
Additional Context
As a temporary workaround, developers can force the append to be a new line character:
// webpack.config.js
const config = {
// --snip--
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: "[file].map",
debugIds: true,
append: '\n', // force append value
module: true,
columns: true,
}),
],
};
export default config;
In that case, append doesn't corrupt the injected debugId, so it looks correct.
Bug Description
When I either set a
devtoolconfig value tohidden-source-map-debugidsor use awebpack.SourceMapDevToolPluginwith a configuration matchinghidden-source-map-debugids, the debug ID appended to the generated.jsfile is corrupted – it looks like//# debugId=<hash>falseinstead of//debugId=<hash>.Link to Minimal Reproduction and step to reproduce
https://github.com/in-doge-we-trust/webpack-debugids-append-issue-repro
Case #1 (
webpack.SourceMapDevToolPluginis used manually) steps:npm installnpm run buildCase #2 (
devtoolset tohidden-source-map-debugids) steps:npm run clear(optional)npm run buildExpected Behavior
debugIdvalue in the source-map file matches the value in//# debugId=<hash>comment appended to the generated.js.Actual Behavior
debugIdvalue in the source-map file is correct, while//# debugId=<hash>comment hasfalseappended to the end and looks like this –//# debugId=<hash>false.Environment
Binaries: Node: 22.18.0 npm: 10.9.3 Packages: webpack: 5.102.1 => 5.102.1 webpack-cli: 6.0.1 => 6.0.1Is this a regression?
No
Last Working Version
No response
Additional Context
As a temporary workaround, developers can force the
appendto be a new line character:In that case,
appenddoesn't corrupt the injecteddebugId, so it looks correct.