Skip to content

Commit

Permalink
fix: should not panic if provide dependency is not resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
JSerFeng committed Aug 19, 2024
1 parent 218bda0 commit 18f529e
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",
})
],
};

0 comments on commit 18f529e

Please sign in to comment.