diff --git a/bench.config.js b/bench.config.js index 7fcd434bf..9bbff84b5 100644 --- a/bench.config.js +++ b/bench.config.js @@ -2,7 +2,7 @@ const isScheduled = !!process.env.SCHEDULED_JOB; // HMR will run 10 times in build plugin, so we should not start multiple instances of Rspack. // However, we still need to run multiple instances of Rspack when executing scheduled tasks for longer runtimes. -const hmrRuns = isScheduled ? 10 : 1; +const hmrRuns = isScheduled ? 10 : 5; export default { jobs: [ diff --git a/lib/scenarios/build-plugin.cjs b/lib/scenarios/build-plugin.cjs index c2d08c535..226e73f55 100644 --- a/lib/scenarios/build-plugin.cjs +++ b/lib/scenarios/build-plugin.cjs @@ -8,22 +8,16 @@ module.exports = class BuildPlugin { compiler.hooks.watchRun.tap("BuildPlugin", () => { isWatching = true; }); - (compiler.hooks.afterDone || compiler.hooks.done).tap("BuildPlugin", () => { - setTimeout(() => { - if (counter === WARMUP_BUILDS) console.log("#!# start"); - if (isWatching && counter <= TOTAL_BUILDS) console.log("#!# next"); - }, 10); + compiler.hooks.afterDone.tap("BuildPlugin", () => { + if (counter === WARMUP_BUILDS) console.log("#!# start"); + if (isWatching && counter <= TOTAL_BUILDS) console.log("#!# next"); }); compiler.hooks.done.tap("BuildPlugin", stats => { if (isWatching) { counter++; if (counter <= WARMUP_BUILDS) return; if (counter > TOTAL_BUILDS) { - if (compiler.watching) { - compiler.watching.close(); - } else { - process.nextTick(() => process.exit(0)); - } + process.nextTick(() => process.exit(0)); } } const { logging, time } = stats.toJson({ @@ -69,10 +63,7 @@ module.exports = class BuildPlugin { if (type !== "time") return; const ms = args[1] * 1000 + args[2] / 1000000; console.log( - `#!# ${name}.${args[0].replace( - /restore cache content \d.+$/, - "restore cache content" - )} = ${ms}` + `#!# ${name}.${args[0].replace(/restore cache content \d.+$/, "restore cache content")} = ${ms}` ); }; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ed37658d8..401209341 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,6 +32,10 @@ importers: zx: specifier: ^8.1.1 version: 8.1.1 + devDependencies: + prettier: + specifier: ^2.6.2 + version: 2.8.8 cases/10000: {}