@@ -123,32 +123,27 @@ var entries = function entries(paths, chunkName) {
123123} ;
124124
125125var assets = function assets ( ) {
126- var assets = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : [ ] ;
127- var extensions = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : [ ] ;
128- return Object . keys ( assets ) . map ( function ( name ) {
129- return extensions . indexOf ( path . extname ( name . indexOf ( '?' ) >= 0 ? name . split ( '?' ) . slice ( 0 , - 1 ) . join ( '' ) : name ) ) >= 0 && { name : name , asset : assets [ name ] } ;
130- } ) . filter ( function ( a ) {
131- return a ;
132- } ) ;
126+ var assets = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : [ ] ;
127+ var extensions = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : [ ] ;
128+ return Object . keys ( assets ) . map ( function ( name ) {
129+ return extensions . indexOf ( path . extname ( name . indexOf ( '?' ) >= 0 ? name . split ( '?' ) . slice ( 0 , - 1 ) . join ( '' ) : name ) ) >= 0 && { name : name , asset : assets [ name ] } ;
130+ } ) . filter ( function ( a ) {
131+ return a ;
132+ } ) ;
133133} ;
134134
135- var files = function files ( ) {
136- var modules = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
137- var extensions = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : [ ] ;
138- var getter = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : function ( a ) {
139- return a ;
140- } ;
141- return Object . keys ( modules ) . map ( function ( name ) {
142- var file = getter ( modules [ name ] ) ;
143-
144- if ( ! file ) {
145- return null ;
146- }
147-
148- return extensions . indexOf ( path . extname ( file ) ) >= 0 && file ;
149- } ) . filter ( function ( a ) {
150- return a ;
151- } ) ;
135+ var files = function files ( chunk ) {
136+ var extensions = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : [ ] ;
137+ var getter = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : function ( a ) {
138+ return a ;
139+ } ;
140+ return chunk . mapModules ( function ( module ) {
141+ var file = getter ( module ) ;
142+ if ( ! file ) return null ;
143+ return extensions . indexOf ( path . extname ( file ) ) >= 0 && file ;
144+ } ) . filter ( function ( a ) {
145+ return a ;
146+ } ) ;
152147} ;
153148
154149var PurgecssPlugin = function ( ) {
@@ -176,9 +171,6 @@ var PurgecssPlugin = function () {
176171 var chunkName = chunk . name ,
177172 files$$1 = chunk . files ;
178173
179- var modules = chunk . mapModules ( function ( mod ) {
180- return mod ;
181- } ) ;
182174 var assetsToPurge = assets ( compilation . assets , [ '.css' ] ) . filter ( function ( asset ) {
183175 return files$$1 . indexOf ( asset . name ) >= 0 ;
184176 } ) ;
@@ -187,7 +179,7 @@ var PurgecssPlugin = function () {
187179 var name = _ref . name ,
188180 asset = _ref . asset ;
189181
190- var filesToSearch = entries ( entryPaths$$1 , chunkName ) . concat ( files ( modules , _this . options . moduleExtensions || [ ] , function ( file ) {
182+ var filesToSearch = entries ( entryPaths$$1 , chunkName ) . concat ( files ( chunk , _this . options . moduleExtensions || [ ] , function ( file ) {
191183 return file . resource ;
192184 } ) ) . filter ( function ( v ) {
193185 return ! v . endsWith ( '.css' ) ;
0 commit comments