Skip to content

Commit

Permalink
fix: should not panic if provide dependency is not resolved (#7609)
Browse files Browse the repository at this point in the history
  • Loading branch information
JSerFeng authored Aug 19, 2024
1 parent c483c0e commit a78044c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ impl DependencyTemplate for ProvideDependency {
} = code_generatable_context;
let module_graph = compilation.get_module_graph();
let Some(con) = module_graph.connection_by_dependency(&self.id) else {
unreachable!();
// not find connection, maybe because it's not resolved in make phase, and `bail` is false
return;
};
let exports_info = module_graph.get_exports_info(con.module_identifier());
let used_name =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = [
/Can't resolve 'not-exist'/
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
try {
foo;
} catch (_) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { rspack } = require("@rspack/core");

/** @type {import("@rspack/core").Configuration} */
module.exports = {
entry: {
main: ["./index.js"]
},
plugins: [
new rspack.ProvidePlugin({
foo: "not-exist",
})
],
};

2 comments on commit a78044c

@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
rslib ✅ success
rsbuild ❌ failure
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-16 218bda0) Current Change
10000_development-mode + exec 2.35 s ± 21 ms 2.37 s ± 25 ms +0.62 %
10000_development-mode_hmr + exec 713 ms ± 13 ms 705 ms ± 8.9 ms -1.03 %
10000_production-mode + exec 3.02 s ± 38 ms 3.04 s ± 47 ms +0.71 %
arco-pro_development-mode + exec 1.91 s ± 68 ms 1.9 s ± 41 ms -0.55 %
arco-pro_development-mode_hmr + exec 439 ms ± 2 ms 438 ms ± 2.2 ms -0.37 %
arco-pro_production-mode + exec 3.48 s ± 110 ms 3.51 s ± 44 ms +1.03 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.52 s ± 98 ms 3.55 s ± 98 ms +0.83 %
threejs_development-mode_10x + exec 1.71 s ± 14 ms 1.72 s ± 14 ms +0.43 %
threejs_development-mode_10x_hmr + exec 823 ms ± 9.3 ms 822 ms ± 4 ms -0.13 %
threejs_production-mode_10x + exec 5.53 s ± 39 ms 5.56 s ± 30 ms +0.47 %

Please sign in to comment.