File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ export class PluginForHtmlWebpackPluginV4 extends BasePlugin {
32
32
private cssStyleMap : Map < HTMLWebpackPlugin , CSSStyle [ ] > = new Map ( )
33
33
34
34
private prepareCSSStyle ( data : BeforeAssetTagGenerationData ) {
35
- data . assets . css . forEach ( ( cssLink , index ) => {
35
+ const [ ...cssAssets ] = data . assets . css
36
+ cssAssets . forEach ( cssLink => {
36
37
if ( this . isCurrentFileNeedsToBeInlined ( cssLink ) ) {
37
38
const style = this . getCSSStyle ( {
38
39
cssLink,
@@ -45,9 +46,11 @@ export class PluginForHtmlWebpackPluginV4 extends BasePlugin {
45
46
} else {
46
47
this . cssStyleMap . set ( data . plugin , [ style ] )
47
48
}
48
-
49
+ const cssLinkIndex = data . assets . css . indexOf ( cssLink )
49
50
// prevent generate <link /> tag
50
- data . assets . css . splice ( index , 1 )
51
+ if ( cssLinkIndex !== - 1 ) {
52
+ data . assets . css . splice ( cssLinkIndex , 1 )
53
+ }
51
54
}
52
55
}
53
56
} )
You can’t perform that action at this time.
0 commit comments