Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ef962fa

Browse files
author
xiangmixue
committed
fix bug: can not inline multiple css
1 parent 126989b commit ef962fa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎src/core/v3.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /