@@ -7,7 +7,7 @@ var async = require("async");
77var Tapable = require ( "tapable" ) ;
88var EntryModuleNotFoundError = require ( "./EntryModuleNotFoundError" ) ;
99var ModuleNotFoundError = require ( "./ModuleNotFoundError" ) ;
10- var CriticalDependenciesWarning = require ( "./CriticalDependenciesWarning " ) ;
10+ var ModuleDependencyWarning = require ( "./ModuleDependencyWarning " ) ;
1111var Module = require ( "./Module" ) ;
1212var ArrayMap = require ( "./ArrayMap" ) ;
1313var Chunk = require ( "./Chunk" ) ;
@@ -184,12 +184,6 @@ Compilation.prototype.addModuleDependencies = function(module, dependencies, bai
184184 }
185185 async . forEach ( factories , function ( item , callback ) {
186186 var dependencies = item [ 1 ] ;
187- var criticalDependencies = dependencies . filter ( function ( d ) {
188- return ! ! d . critical ;
189- } ) ;
190- if ( criticalDependencies . length > 0 ) {
191- _this . warnings . push ( new CriticalDependenciesWarning ( module , criticalDependencies ) ) ;
192- }
193187
194188 var errorAndCallback = function errorAndCallback ( err ) {
195189 err . dependencies = dependencies ;
@@ -484,6 +478,10 @@ Compilation.prototype.rebuildModule = function(module, thisCallback) {
484478} ;
485479
486480Compilation . prototype . seal = function seal ( callback ) {
481+ this . applyPlugins ( "finish-modules" , this . modules ) ;
482+ this . modules . forEach ( function ( m ) {
483+ this . reportDependencyWarnings ( m , [ m ] ) ;
484+ } , this ) ;
487485 this . applyPlugins ( "seal" ) ;
488486 this . preparedChunks . sort ( function ( a , b ) {
489487 if ( a . name < b . name ) return - 1 ;
@@ -589,6 +587,23 @@ Compilation.prototype.sortModules = function sortModules(modules) {
589587 } ) ;
590588} ;
591589
590+ Compilation . prototype . reportDependencyWarnings = function reportDependencyWarnings ( module , blocks ) {
591+ var _this = this ;
592+ blocks . forEach ( function ( block ) {
593+ block . dependencies . forEach ( function ( d ) {
594+ var warnings = d . getWarnings ( ) ;
595+ if ( warnings ) {
596+ warnings . forEach ( function ( w ) {
597+ var warning = new ModuleDependencyWarning ( module , w , d . loc ) ;
598+ module . warnings . push ( warning ) ;
599+ _this . warnings . push ( warning ) ;
600+ } ) ;
601+ }
602+ } ) ;
603+ _this . reportDependencyWarnings ( module , block . blocks ) ;
604+ } ) ;
605+ } ;
606+
592607Compilation . prototype . addChunk = function addChunk ( name , module , loc ) {
593608 var chunk ;
594609 if ( name ) {
0 commit comments