Line numbers in source map incorrect
Author: rgpublicCreated Jul 30, 2024Updated Sep 14, 2026
Labelspending triage
The line number sometimes are a bit off. I tried to get to the bottom of this and reduce as much styles as possible. See attached ZIP. I'm using the NodeJS API and basically this code (excerpt):
let { code, map } = transform({
filename: 'style.css',
code: Buffer.from(codeBuffer),
inputSourceMap: Buffer.from(mapBuffer),
minify: true,
sourceMap: true
});
code+="\n\/\*# sourceMappingURL="+path.basename(outfile)+".map */\n";If included the input code (index_unminified.css) and input source map (index_unminified.css.map) in the ZIP. Now for this selector: ".paragraph-stage .body .field-body h1.text-align-center strong" the line number shown in the browser's developer console is 63. Correct would be 76. If I remove anyform_errors.scss, it works. So the problem must be caused by the styles in this file. I couldn't narrow it down further unfortunately. Hope it helps.
Source: parcel-bundler/lightningcss