File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 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 {
3232 private cssStyleMap : Map < HTMLWebpackPlugin , CSSStyle [ ] > = new Map ( )
3333
3434 private prepareCSSStyle ( data : BeforeAssetTagGenerationData ) {
35- data . assets . css . forEach ( ( cssLink , index ) => {
35+ const [ ...cssAssets ] = data . assets . css
36+ cssAssets . forEach ( cssLink => {
3637 if ( this . isCurrentFileNeedsToBeInlined ( cssLink ) ) {
3738 const style = this . getCSSStyle ( {
3839 cssLink,
@@ -45,9 +46,11 @@ export class PluginForHtmlWebpackPluginV4 extends BasePlugin {
4546 } else {
4647 this . cssStyleMap . set ( data . plugin , [ style ] )
4748 }
48-
49+ const cssLinkIndex = data . assets . css . indexOf ( cssLink )
4950 // prevent generate <link /> tag
50- data . assets . css . splice ( index , 1 )
51+ if ( cssLinkIndex !== - 1 ) {
52+ data . assets . css . splice ( cssLinkIndex , 1 )
53+ }
5154 }
5255 }
5356 } )
You can’t perform that action at this time.
0 commit comments