The sources array of merged source maps is not always in the same order as the original sources array. By using the original source map's sourcesContent together with the merged source map's sources, the 2 array might not be aligned, which produces a malformed source map.
I believe sourcesContent gets copied from input to the merged source map because the multi-stage-sourcemap library at one point did not produce sourcesContent. But multi-stage-sourcemap has added support for sourcesContent since version 0.3.0 (this project requires ^0.3.1).
I can confirm that this pull request fixes the main issue I've been having with this package. I can live with working from the fork, but it'd be nicer if this was also fixed in the main version on the npm registry.
The
sources
array of merged source maps is not always in the same order as the originalsources
array. By using the original source map'ssourcesContent
together with the merged source map'ssources
, the 2 array might not be aligned, which produces a malformed source map.I believe
sourcesContent
gets copied from input to the merged source map because themulti-stage-sourcemap
library at one point did not producesourcesContent
. Butmulti-stage-sourcemap
has added support forsourcesContent
since version0.3.0
(this project requires^0.3.1
).