Skip to content

Commit

Permalink
fix(rust-core): no need to pass resolve_factory when using rust api (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hardfist authored Aug 12, 2024
1 parent a62b9cc commit fe1bbe9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/node_binding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ impl Rspack {
plugins,
AsyncNodeWritableFileSystem::new(output_filesystem)
.map_err(|e| Error::from_reason(format!("Failed to create writable filesystem: {e}",)))?,
resolver_factory,
loader_resolver_factory,
Some(resolver_factory),
Some(loader_resolver_factory),
);

Ok(Self {
Expand Down
9 changes: 7 additions & 2 deletions crates/rspack_core/src/compiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,20 @@ where
options: CompilerOptions,
plugins: Vec<BoxPlugin>,
output_filesystem: T,
resolver_factory: Arc<ResolverFactory>,
loader_resolver_factory: Arc<ResolverFactory>,
// no need to pass resolve_factory in rust api
resolver_factory: Option<Arc<ResolverFactory>>,
loader_resolver_factory: Option<Arc<ResolverFactory>>,
) -> Self {
#[cfg(debug_assertions)]
{
if let Ok(mut debug_info) = crate::debug_info::DEBUG_INFO.lock() {
debug_info.with_context(options.context.to_string());
}
}
let resolver_factory =
resolver_factory.unwrap_or_else(|| Arc::new(ResolverFactory::new(options.resolve.clone())));
let loader_resolver_factory = loader_resolver_factory
.unwrap_or_else(|| Arc::new(ResolverFactory::new(options.resolve_loader.clone())));
let (plugin_driver, options) = PluginDriver::new(options, plugins, resolver_factory.clone());
let old_cache = Arc::new(OldCache::new(options.clone()));
let module_executor = ModuleExecutor::default();
Expand Down

2 comments on commit fe1bbe9

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs ❌ failure
_selftest ✅ success
nx ❌ failure
rspress ✅ success
rsbuild ✅ success
examples ✅ success

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-08-12 a7844d9) Current Change
10000_development-mode + exec 2.31 s ± 26 ms 2.31 s ± 27 ms +0.09 %
10000_development-mode_hmr + exec 697 ms ± 10 ms 699 ms ± 10 ms +0.22 %
10000_production-mode + exec 2.86 s ± 21 ms 2.88 s ± 27 ms +0.68 %
arco-pro_development-mode + exec 1.86 s ± 57 ms 1.89 s ± 48 ms +1.74 %
arco-pro_development-mode_hmr + exec 433 ms ± 1.1 ms 434 ms ± 0.79 ms +0.22 %
arco-pro_production-mode + exec 3.45 s ± 74 ms 3.51 s ± 86 ms +1.67 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.54 s ± 88 ms 3.51 s ± 87 ms -1.06 %
threejs_development-mode_10x + exec 1.7 s ± 12 ms 1.71 s ± 16 ms +0.60 %
threejs_development-mode_10x_hmr + exec 821 ms ± 5.6 ms 820 ms ± 7.7 ms -0.09 %
threejs_production-mode_10x + exec 5.48 s ± 32 ms 5.5 s ± 34 ms +0.45 %

Please sign in to comment.