Skip to content

Commit

Permalink
feat: support compilation.hooks.childCompiler (#4773)
Browse files Browse the repository at this point in the history
  • Loading branch information
bvanjoi authored Nov 24, 2023
1 parent db22613 commit 6bf4904
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions packages/rspack/src/Compilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export class Compilation {

hooks: {
processAssets: ReturnType<typeof createFakeProcessAssetsHook>;
childCompiler: tapable.SyncHook<[Compiler, string, number]>;
log: tapable.SyncBailHook<[string, LogEntry], true>;
additionalAssets: any;
optimizeModules: tapable.SyncBailHook<Iterable<JsModule>, undefined>;
Expand Down Expand Up @@ -159,6 +160,11 @@ export class Compilation {
Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
() => []
),
childCompiler: new tapable.SyncHook([
"childCompiler",
"compilerName",
"compilerIndex"
]),
log: new tapable.SyncBailHook(["origin", "logEntry"]),
optimizeModules: new tapable.SyncBailHook(["modules"]),
optimizeTree: new tapable.AsyncSeriesBailHook(["chunks", "modules"]),
Expand Down
10 changes: 5 additions & 5 deletions packages/rspack/src/Compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ class Compiler {
}
}

// compilation.hooks.childCompiler.call(
// childCompiler,
// compilerName,
// compilerIndex
// );
compilation.hooks.childCompiler.call(
childCompiler,
compilerName,
compilerIndex
);

return childCompiler;
}
Expand Down

0 comments on commit 6bf4904

Please sign in to comment.