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 126989b

Browse files
author
xiangmixue
committed
fix bug: cannot inline multiple css
1 parent 9ffc73a commit 126989b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/core/v4.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff 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+
constcssLinkIndex=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
})

0 commit comments

Comments
(0)

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