File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,11 @@ module.exports = function parse (modules, opts) {
6666 s . stream . pipe ( concat ( { encoding : 'string' } , function ( chunk ) {
6767 // We have to give magic-string the replacement string,
6868 // so it can calculate the amount of lines and columns.
69- sourcemapper . overwrite ( s . start , s . start + s . offset , chunk ) ;
69+ if ( s . offset === 0 ) {
70+ sourcemapper . appendRight ( s . start , chunk ) ;
71+ } else {
72+ sourcemapper . overwrite ( s . start , s . start + s . offset , chunk ) ;
73+ }
7074 } ) ) . on ( 'finish' , next ) ;
7175 } else {
7276 s . stream . on ( 'end' , next ) ;
Original file line number Diff line number Diff line change @@ -77,7 +77,10 @@ test('multi consecutive require vars', function (t) {
7777 return fs . createReadStream ( file ) . pipe ( quote ( ) ) ;
7878 }
7979 }
80- } , { vars : { __dirname : path . join ( __dirname , 'vars' ) } } ) ;
80+ } , {
81+ vars : { __dirname : path . join ( __dirname , 'vars' ) } ,
82+ sourceMap : true // Make sure source maps work when replacing 0 length ranges.
83+ } ) ;
8184
8285 readStream ( 'multi-require.js' ) . pipe ( sm ) . pipe ( concat ( function ( body ) {
8386 Function ( [ 'console' , 'require' ] , body ) ( { log : log } , function ( ) { return { } } ) ;
You can’t perform that action at this time.
0 commit comments