@@ -55,6 +55,35 @@ class ExtractTextPlugin {
55
55
return ExtractTextPlugin . loader ( mergeOptions ( { id : this . id } , options ) ) ;
56
56
}
57
57
58
+ mergeNonInitialChunks ( chunk , intoChunk , checkedChunks ) {
59
+ if ( ! intoChunk ) {
60
+ checkedChunks = [ ] ;
61
+ chunk . chunks . forEach ( ( c ) => {
62
+ if ( isInitialOrHasNoParents ( c ) ) return ;
63
+ this . mergeNonInitialChunks ( c , chunk , checkedChunks ) ;
64
+ } , this ) ;
65
+ } else if ( checkedChunks . indexOf ( chunk ) < 0 ) {
66
+ checkedChunks . push ( chunk ) ;
67
+ chunk . modules . slice ( ) . forEach ( ( module ) => {
68
+ intoChunk . addModule ( module ) ;
69
+ module . addChunk ( intoChunk ) ;
70
+ } ) ;
71
+ chunk . chunks . forEach ( ( c ) => {
72
+ if ( isInitialOrHasNoParents ( c ) ) return ;
73
+ this . mergeNonInitialChunks ( c , intoChunk , checkedChunks ) ;
74
+ } , this ) ;
75
+ }
76
+ }
77
+
78
+ renderExtractedChunk ( chunk ) {
79
+ const source = new ConcatSource ( ) ;
80
+ chunk . modules . forEach ( ( module ) => {
81
+ const moduleSource = module . source ( ) ;
82
+ source . add ( this . applyAdditionalInformation ( moduleSource , module . additionalInformation ) ) ;
83
+ } , this ) ;
84
+ return source ;
85
+ }
86
+
58
87
extract ( options ) {
59
88
if ( Array . isArray ( options ) || isString ( options ) || typeof options . options === 'object' || typeof options . query === 'object' ) {
60
89
options = { use : options } ;
@@ -192,35 +221,6 @@ class ExtractTextPlugin {
192
221
}
193
222
}
194
223
195
- export default ExtractTextPlugin ;
196
-
197
- ExtractTextPlugin . prototype . mergeNonInitialChunks = function ( chunk , intoChunk , checkedChunks ) { // eslint-disable-line func-names
198
- if ( ! intoChunk ) {
199
- checkedChunks = [ ] ;
200
- chunk . chunks . forEach ( ( c ) => {
201
- if ( isInitialOrHasNoParents ( c ) ) return ;
202
- this . mergeNonInitialChunks ( c , chunk , checkedChunks ) ;
203
- } , this ) ;
204
- } else if ( checkedChunks . indexOf ( chunk ) < 0 ) {
205
- checkedChunks . push ( chunk ) ;
206
- chunk . modules . slice ( ) . forEach ( ( module ) => {
207
- intoChunk . addModule ( module ) ;
208
- module . addChunk ( intoChunk ) ;
209
- } ) ;
210
- chunk . chunks . forEach ( ( c ) => {
211
- if ( isInitialOrHasNoParents ( c ) ) return ;
212
- this . mergeNonInitialChunks ( c , intoChunk , checkedChunks ) ;
213
- } , this ) ;
214
- }
215
- } ;
216
-
217
- ExtractTextPlugin . prototype . renderExtractedChunk = function ( chunk ) { // eslint-disable-line func-names
218
- const source = new ConcatSource ( ) ;
219
- chunk . modules . forEach ( ( module ) => {
220
- const moduleSource = module . source ( ) ;
221
- source . add ( this . applyAdditionalInformation ( moduleSource , module . additionalInformation ) ) ;
222
- } , this ) ;
223
- return source ;
224
- } ;
225
-
226
224
ExtractTextPlugin . extract = ExtractTextPlugin . prototype . extract . bind ( ExtractTextPlugin ) ;
225
+
226
+ export default ExtractTextPlugin ;
0 commit comments