Skip to content

Commit d60c640

Browse files
committed
fix: assets source become undefined in some scenario
Related to issue #1, where multiple instances of html-webpack-plugin is used
1 parent 156f34b commit d60c640

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/HtmlInlineScriptPlugin.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,13 @@ class HtmlInlineScriptPlugin {
6464
);
6565
return data;
6666
});
67+
});
6768

68-
hooks.beforeEmit.tap(`${PLUGIN_PREFIX}_beforeEmit`, (data) => {
69-
Object.keys(compilation.assets).forEach((assetName) => {
70-
if (this.isFileNeedsToBeInlined(assetName)) {
71-
delete compilation.assets[assetName];
72-
}
73-
});
74-
return data;
69+
compiler.hooks.emit.tap(`${PLUGIN_PREFIX}_emit`, (compilation) => {
70+
Object.keys(compilation.assets).forEach((assetName) => {
71+
if (this.isFileNeedsToBeInlined(assetName)) {
72+
delete compilation.assets[assetName];
73+
}
7574
});
7675
});
7776
}

0 commit comments

Comments
 (0)