File tree 1 file changed +10
-22
lines changed
1 file changed +10
-22
lines changed Original file line number Diff line number Diff line change @@ -28,28 +28,16 @@ class JsonpMainTemplatePlugin {
28
28
}
29
29
return false ;
30
30
} ;
31
- // TODO refactor this
32
- if ( ! mainTemplate . hooks . jsonpScript ) {
33
- mainTemplate . hooks . jsonpScript = new SyncWaterfallHook ( [
34
- "source" ,
35
- "chunk" ,
36
- "hash"
37
- ] ) ;
38
- }
39
- if ( ! mainTemplate . hooks . linkPreload ) {
40
- mainTemplate . hooks . linkPreload = new SyncWaterfallHook ( [
41
- "source" ,
42
- "chunk" ,
43
- "hash"
44
- ] ) ;
45
- }
46
- if ( ! mainTemplate . hooks . linkPrefetch ) {
47
- mainTemplate . hooks . linkPrefetch = new SyncWaterfallHook ( [
48
- "source" ,
49
- "chunk" ,
50
- "hash"
51
- ] ) ;
52
- }
31
+
32
+ [ "jsonpScript" , "linkPreload" , "linkPrefetch" ] . forEach ( hook => {
33
+ if ( ! mainTemplate . hooks [ hook ] ) {
34
+ mainTemplate . hooks [ hook ] = new SyncWaterfallHook ( [
35
+ "source" ,
36
+ "chunk" ,
37
+ "hash"
38
+ ] ) ;
39
+ }
40
+ } ) ;
53
41
54
42
const getScriptSrcPath = ( hash , chunk , chunkIdExpression ) => {
55
43
const chunkFilename = mainTemplate . outputOptions . chunkFilename ;
You can’t perform that action at this time.
0 commit comments