Skip to content

Commit 07b49c2

Browse files
authored
refactor: use sync hook of afterCompile (#877)
1 parent f0c97fd commit 07b49c2

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

packages/core/src/plugins/EntryChunkPlugin.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,15 @@ class EntryChunkPlugin {
5959
}
6060

6161
apply(compiler: Rspack.Compiler) {
62-
// TODO: contextDependencies now can only be added in `tapPromise` hook.
63-
// Change to `.tap` when it's supported.
64-
compiler.hooks.afterCompile.tapPromise(PLUGIN_NAME, (compilation) => {
65-
return new Promise((resolve) => {
66-
if (this.contextToWatch === null) {
67-
resolve();
68-
return;
69-
}
62+
compiler.hooks.afterCompile.tap(PLUGIN_NAME, (compilation) => {
63+
if (this.contextToWatch === null) {
64+
return;
65+
}
7066

71-
const contextDep = compilation.contextDependencies;
72-
if (!contextDep.has(this.contextToWatch)) {
73-
contextDep.add(this.contextToWatch);
74-
}
75-
resolve();
76-
});
67+
const contextDep = compilation.contextDependencies;
68+
if (!contextDep.has(this.contextToWatch)) {
69+
contextDep.add(this.contextToWatch);
70+
}
7771
});
7872

7973
compiler.hooks.make.tap(PLUGIN_NAME, (compilation) => {

0 commit comments

Comments
 (0)