File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ export class PluginForHtmlWebpackPluginV3 extends BasePlugin {
1717 private process ( data : HtmlWebpackPluginData ) {
1818 // check if current html needs to be inlined
1919 if ( this . isCurrentFileNeedsToBeInlined ( data . outputName ) ) {
20- data . assets . css . forEach ( ( cssLink , index ) => {
20+ const [ ...cssAssets ] = data . assets . css
21+ cssAssets . forEach ( cssLink => {
2122 const style = this . getCSSStyle ( {
2223 cssLink,
2324 publicPath : data . assets . publicPath ,
@@ -30,8 +31,11 @@ export class PluginForHtmlWebpackPluginV3 extends BasePlugin {
3031 style : style ,
3132 } )
3233
34+ const cssLinkIndex = data . assets . css . indexOf ( cssLink )
3335 // prevent generate <link /> tag
34- data . assets . css . splice ( index , 1 )
36+ if ( cssLinkIndex !== - 1 ) {
37+ data . assets . css . splice ( cssLinkIndex , 1 )
38+ }
3539 }
3640 } )
3741
You can’t perform that action at this time.
0 commit comments