@@ -36,6 +36,7 @@ class LoaderPlugin {
3636 } `
3737 )
3838 ) ;
39+ compilation . semaphore . release ( ) ;
3940 compilation . addModuleDependencies (
4041 module ,
4142 [
@@ -48,37 +49,39 @@ class LoaderPlugin {
4849 "lm" ,
4950 false ,
5051 err => {
51- if ( err ) return callback ( err ) ;
52+ compilation . semaphore . acquire ( ( ) => {
53+ if ( err ) return callback ( err ) ;
5254
53- if ( ! dep . module )
54- return callback ( new Error ( "Cannot load the module" ) ) ;
55+ if ( ! dep . module )
56+ return callback ( new Error ( "Cannot load the module" ) ) ;
5557
56- if ( dep . module . error ) return callback ( dep . module . error ) ;
57- if ( ! dep . module . _source )
58- throw new Error (
59- "The module created for a LoaderDependency must have a property _source"
60- ) ;
61- let source , map ;
62- const moduleSource = dep . module . _source ;
63- if ( moduleSource . sourceAndMap ) {
64- const sourceAndMap = moduleSource . sourceAndMap ( ) ;
65- map = sourceAndMap . map ;
66- source = sourceAndMap . source ;
67- } else {
68- map = moduleSource . map ( ) ;
69- source = moduleSource . source ( ) ;
70- }
71- if ( dep . module . buildInfo . fileDependencies ) {
72- for ( const d of dep . module . buildInfo . fileDependencies ) {
73- loaderContext . addDependency ( d ) ;
58+ if ( dep . module . error ) return callback ( dep . module . error ) ;
59+ if ( ! dep . module . _source )
60+ throw new Error (
61+ "The module created for a LoaderDependency must have a property _source"
62+ ) ;
63+ let source , map ;
64+ const moduleSource = dep . module . _source ;
65+ if ( moduleSource . sourceAndMap ) {
66+ const sourceAndMap = moduleSource . sourceAndMap ( ) ;
67+ map = sourceAndMap . map ;
68+ source = sourceAndMap . source ;
69+ } else {
70+ map = moduleSource . map ( ) ;
71+ source = moduleSource . source ( ) ;
7472 }
75- }
76- if ( dep . module . buildInfo . contextDependencies ) {
77- for ( const d of dep . module . buildInfo . contextDependencies ) {
78- loaderContext . addContextDependency ( d ) ;
73+ if ( dep . module . buildInfo . fileDependencies ) {
74+ for ( const d of dep . module . buildInfo . fileDependencies ) {
75+ loaderContext . addDependency ( d ) ;
76+ }
7977 }
80- }
81- return callback ( null , source , map , dep . module ) ;
78+ if ( dep . module . buildInfo . contextDependencies ) {
79+ for ( const d of dep . module . buildInfo . contextDependencies ) {
80+ loaderContext . addContextDependency ( d ) ;
81+ }
82+ }
83+ return callback ( null , source , map , dep . module ) ;
84+ } ) ;
8285 }
8386 ) ;
8487 } ;
0 commit comments