Skip to content

Commit

Permalink
perf: add_include
Browse files Browse the repository at this point in the history
  • Loading branch information
SyMind committed Jan 7, 2025
1 parent f696097 commit 8ded34b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 4 additions & 6 deletions crates/rspack_binding_values/src/compilation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,12 +758,10 @@ impl JsCompilation {
.map(|(dependency, _)| *dependency.id())
.collect::<Vec<_>>();

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
Expand Down
5 changes: 3 additions & 2 deletions packages/rspack/src/Compilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
*/
get entrypoints(): ReadonlyMap<string, Entrypoint> {
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];
})
);
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8ded34b

Please sign in to comment.