File tree Expand file tree Collapse file tree 4 files changed +20
-0
lines changed
test/configCases/devtools/eval-nosources-source-map Expand file tree Collapse file tree 4 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,9 @@ class EvalSourceMapDevToolPlugin {
153153 }
154154 ) ;
155155 sourceMap . sources = moduleFilenames ;
156+ if ( options . noSources ) {
157+ sourceMap . sourcesContent = undefined ;
158+ }
156159 sourceMap . sourceRoot = options . sourceRoot || "" ;
157160 const moduleId = chunkGraph . getModuleId ( m ) ;
158161 sourceMap . file = `${ moduleId } .js` ;
Original file line number Diff line number Diff line change 1+ it ( "should not include sourcesContent if noSources option is used" , function ( ) {
2+ var fs = require ( "fs" ) ;
3+ var source = fs . readFileSync ( __filename , "utf-8" ) ;
4+ var match = / \/ \/ # s o u r c e M a p p i n g U R L \s * = \s * d a t a : a p p l i c a t i o n \/ j s o n ; c h a r s e t = u t f - 8 ; b a s e 6 4 , ( .* ) \\ n \/ \/ # / . exec ( source ) ;
5+ var mapString = Buffer . from ( match [ 1 ] , 'base64' ) . toString ( 'utf-8' ) ;
6+ var map = JSON . parse ( mapString ) ;
7+ expect ( map ) . not . toHaveProperty ( "sourcesContent" ) ;
8+ } ) ;
9+
10+ if ( Math . random ( ) < 0 ) require ( "./test.js" ) ;
Original file line number Diff line number Diff line change 1+ var foo = { } ;
2+
3+ module . exports = foo ;
Original file line number Diff line number Diff line change 1+ /** @type {import("../../../../").Configuration } */
2+ module . exports = {
3+ devtool : "eval-nosources-source-map"
4+ } ;
You can’t perform that action at this time.
0 commit comments