From 8ded34b69cf725071e00580f6fd71d1bd332dda5 Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Tue, 7 Jan 2025 17:06:21 +0800 Subject: [PATCH] perf: add_include --- crates/rspack_binding_values/src/compilation/mod.rs | 10 ++++------ packages/rspack/src/Compilation.ts | 5 +++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/rspack_binding_values/src/compilation/mod.rs b/crates/rspack_binding_values/src/compilation/mod.rs index 96634d6bd5c..ad322ac0694 100644 --- a/crates/rspack_binding_values/src/compilation/mod.rs +++ b/crates/rspack_binding_values/src/compilation/mod.rs @@ -758,12 +758,10 @@ impl JsCompilation { .map(|(dependency, _)| *dependency.id()) .collect::>(); - for arg in args { - compilation - .add_include(vec![arg]) - .await - .map_err(|e| Error::new(napi::Status::GenericFailure, format!("{e}")))?; - } + compilation + .add_include(args) + .await + .map_err(|e| Error::new(napi::Status::GenericFailure, format!("{e}")))?; let module_graph = compilation.get_module_graph(); let results = dependency_ids diff --git a/packages/rspack/src/Compilation.ts b/packages/rspack/src/Compilation.ts index 09c72fd03ff..97507e57cb4 100644 --- a/packages/rspack/src/Compilation.ts +++ b/packages/rspack/src/Compilation.ts @@ -407,9 +407,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si */ get entrypoints(): ReadonlyMap { return new Map( - this.#inner.entrypoints.map((binding) => { + this.#inner.entrypoints.map(binding => { const entrypoint = Entrypoint.__from_binding(binding); - return [entrypoint.name!, entrypoint] + return [entrypoint.name!, entrypoint]; }) ); } @@ -1265,6 +1265,7 @@ class AddIncludeDispatcher { this.#args = []; const cbs = this.#cbs; this.#cbs = []; + console.log("args.length", args.length); this.#inner(args, (wholeErr, results) => { if (this.#args.length !== 0) { queueMicrotask(this.#execute);