Skip to content

Commit 41ebbb7

Browse files
committed
fix: duplicated style at webpack watch mode
fix #30 and #13
1 parent 0a67099 commit 41ebbb7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/core/v4.ts

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ export class PluginForHtmlWebpackPluginV4 extends BasePlugin {
3232
private cssStyleMap: Map<HTMLWebpackPlugin, CSSStyle[]> = new Map()
3333

3434
private prepareCSSStyle(data: BeforeAssetTagGenerationData) {
35+
// `prepareCSSStyle` may be called more than once in webpack watch mode.
36+
// https://github.com/Runjuu/html-inline-css-webpack-plugin/issues/30
37+
// https://github.com/Runjuu/html-inline-css-webpack-plugin/issues/13
38+
this.cssStyleMap.clear()
39+
3540
const [...cssAssets] = data.assets.css
3641
cssAssets.forEach((cssLink) => {
3742
if (this.isCurrentFileNeedsToBeInlined(cssLink)) {

0 commit comments

Comments
 (0)