@@ -13,11 +13,14 @@ import { v4 as uuidv4 } from "uuid";
13
13
14
14
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
15
15
// @ts -ignore webpack is a peer dep
16
- import * as webback4or5 from "webpack" ;
16
+ import * as webpack4or5 from "webpack" ;
17
17
18
18
interface BannerPluginCallbackArg {
19
19
chunk ?: {
20
20
hash ?: string ;
21
+ contentHash ?: {
22
+ javascript ?: string ;
23
+ } ;
21
24
} ;
22
25
}
23
26
@@ -33,8 +36,8 @@ function webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {
33
36
// @ts -ignore webpack version compatibility shenanigans
34
37
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
35
38
compiler ?. webpack ?. BannerPlugin ||
36
- webback4or5 ?. BannerPlugin ||
37
- webback4or5 ?. default ?. BannerPlugin ;
39
+ webpack4or5 ?. BannerPlugin ||
40
+ webpack4or5 ?. default ?. BannerPlugin ;
38
41
compiler . options . plugins = compiler . options . plugins || [ ] ;
39
42
compiler . options . plugins . push (
40
43
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
@@ -74,8 +77,8 @@ function webpackBundleSizeOptimizationsPlugin(
74
77
// @ts -ignore webpack version compatibility shenanigans
75
78
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
76
79
compiler ?. webpack ?. DefinePlugin ||
77
- webback4or5 ?. DefinePlugin ||
78
- webback4or5 ?. default ?. DefinePlugin ;
80
+ webpack4or5 ?. DefinePlugin ||
81
+ webpack4or5 ?. default ?. DefinePlugin ;
79
82
compiler . options . plugins = compiler . options . plugins || [ ] ;
80
83
compiler . options . plugins . push (
81
84
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
@@ -99,16 +102,17 @@ function webpackDebugIdInjectionPlugin(): UnpluginOptions {
99
102
// @ts -ignore webpack version compatibility shenanigans
100
103
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
101
104
compiler ?. webpack ?. BannerPlugin ||
102
- webback4or5 ?. BannerPlugin ||
103
- webback4or5 ?. default ?. BannerPlugin ;
105
+ webpack4or5 ?. BannerPlugin ||
106
+ webpack4or5 ?. default ?. BannerPlugin ;
104
107
compiler . options . plugins = compiler . options . plugins || [ ] ;
105
108
compiler . options . plugins . push (
106
109
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
107
110
new BannerPlugin ( {
108
111
raw : true ,
109
112
include : / \. ( j s | t s | j s x | t s x | m j s | c j s ) ( \? [ ^ ? ] * ) ? ( # [ ^ # ] * ) ? $ / ,
110
113
banner : ( arg ?: BannerPluginCallbackArg ) => {
111
- const debugId = arg ?. chunk ?. hash ? stringToUUID ( arg . chunk . hash ) : uuidv4 ( ) ;
114
+ const hash = arg ?. chunk ?. contentHash ?. javascript ?? arg ?. chunk ?. hash ;
115
+ const debugId = hash ? stringToUUID ( hash ) : uuidv4 ( ) ;
112
116
return getDebugIdSnippet ( debugId ) ;
113
117
} ,
114
118
} )
@@ -161,8 +165,8 @@ function webpackModuleMetadataInjectionPlugin(injectionCode: string): UnpluginOp
161
165
// @ts -ignore webpack version compatibility shenanigans
162
166
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
163
167
compiler ?. webpack ?. BannerPlugin ||
164
- webback4or5 ?. BannerPlugin ||
165
- webback4or5 ?. default ?. BannerPlugin ;
168
+ webpack4or5 ?. BannerPlugin ||
169
+ webpack4or5 ?. default ?. BannerPlugin ;
166
170
compiler . options . plugins = compiler . options . plugins || [ ] ;
167
171
compiler . options . plugins . push (
168
172
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
0 commit comments