@@ -191,39 +191,38 @@ export function pitch(request) {
191
191
const assetsInfo = new Map ( ) ;
192
192
const emit = typeof options . emit !== 'undefined' ? options . emit : true ;
193
193
194
- let addDependencies ;
195
194
if ( emit ) {
196
195
for ( const asset of compilation . getAssets ( ) ) {
197
196
assets [ asset . name ] = asset . source ;
198
197
assetsInfo . set ( asset . name , asset . info ) ;
199
198
}
199
+ }
200
200
201
- addDependencies = ( dependencies ) => {
202
- const identifierCountMap = new Map ( ) ;
201
+ const addDependencies = ( dependencies ) => {
202
+ const identifierCountMap = new Map ( ) ;
203
203
204
- let lastDep ;
204
+ let lastDep ;
205
205
206
- for ( const dependency of dependencies ) {
207
- if ( ! dependency . identifier ) {
208
- // eslint-disable-next-line no-continue
209
- continue ;
210
- }
206
+ for ( const dependency of dependencies ) {
207
+ if ( ! dependency . identifier ) {
208
+ // eslint-disable-next-line no-continue
209
+ continue ;
210
+ }
211
211
212
- const count = identifierCountMap . get ( dependency . identifier ) || 0 ;
213
- const CssDependency = MiniCssExtractPlugin . getCssDependency ( webpack ) ;
212
+ const count = identifierCountMap . get ( dependency . identifier ) || 0 ;
213
+ const CssDependency = MiniCssExtractPlugin . getCssDependency ( webpack ) ;
214
214
215
- this . _module . addDependency (
216
- ( lastDep = new CssDependency ( dependency , dependency . context , count ) )
217
- ) ;
218
- identifierCountMap . set ( dependency . identifier , count + 1 ) ;
219
- }
215
+ this . _module . addDependency (
216
+ ( lastDep = new CssDependency ( dependency , dependency . context , count ) )
217
+ ) ;
218
+ identifierCountMap . set ( dependency . identifier , count + 1 ) ;
219
+ }
220
220
221
- if ( lastDep ) {
222
- lastDep . assets = assets ;
223
- lastDep . assetsInfo = assetsInfo ;
224
- }
225
- } ;
226
- }
221
+ if ( lastDep ) {
222
+ lastDep . assets = assets ;
223
+ lastDep . assetsInfo = assetsInfo ;
224
+ }
225
+ } ;
227
226
228
227
if ( error ) {
229
228
return callback ( error ) ;
@@ -274,30 +273,29 @@ export function pitch(request) {
274
273
locals = exports && exports . locals ;
275
274
}
276
275
277
- if ( emit ) {
278
- let dependencies ;
276
+ let dependencies ;
279
277
280
- if ( ! Array . isArray ( exports ) ) {
281
- dependencies = [ [ null , exports ] ] ;
282
- } else {
283
- dependencies = exports . map ( ( [ id , content , media , sourceMap ] ) => {
284
- const module = findModuleById ( compilation , id ) ;
285
-
286
- return {
287
- identifier : module . identifier ( ) ,
288
- context : module . context ,
289
- content : Buffer . from ( content ) ,
290
- media,
291
- sourceMap : sourceMap
292
- ? Buffer . from ( JSON . stringify ( sourceMap ) )
293
- : // eslint-disable-next-line no-undefined
294
- undefined ,
295
- } ;
296
- } ) ;
297
- }
298
-
299
- addDependencies ( dependencies ) ;
278
+ if ( ! Array . isArray ( exports ) ) {
279
+ dependencies = [ [ null , exports ] ] ;
280
+ } else if ( ! emit ) {
281
+ dependencies = exports ;
282
+ } else {
283
+ dependencies = exports . map ( ( [ id , content , media , sourceMap ] ) => {
284
+ const module = findModuleById ( compilation , id ) ;
285
+
286
+ return {
287
+ identifier : module . identifier ( ) ,
288
+ context : module . context ,
289
+ content : Buffer . from ( content ) ,
290
+ media,
291
+ sourceMap : sourceMap
292
+ ? Buffer . from ( JSON . stringify ( sourceMap ) )
293
+ : // eslint-disable-next-line no-undefined
294
+ undefined ,
295
+ } ;
296
+ } ) ;
300
297
}
298
+ addDependencies ( dependencies ) ;
301
299
} catch ( e ) {
302
300
return callback ( e ) ;
303
301
}
0 commit comments