File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
crates/rspack_core/src/module_graph Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -598,10 +598,13 @@ impl ModuleGraph {
598598 . dependencies
599599 . get_mut ( dependency_id)
600600 . unwrap_or_else ( || panic ! ( "Dependency with ID {dependency_id:?} not found" ) ) ;
601- if Arc :: strong_count ( dep) != 1 {
601+ // Ensure unique mutable access; account for both strong and weak refs.
602+ if Arc :: get_mut ( dep) . is_none ( ) {
602603 * dep = Arc :: from ( clone_box ( dep. as_ref ( ) ) ) ;
603604 }
604- Arc :: get_mut ( dep) . unwrap_or_else ( || panic ! ( "Dependency with ID {dependency_id:?} not found" ) )
605+ Arc :: get_mut ( dep) . unwrap_or_else ( || {
606+ panic ! ( "Cannot obtain unique mutable access for dependency with ID {dependency_id:?}" )
607+ } )
605608 }
606609
607610 /// Uniquely identify a module by its dependency
You can’t perform that action at this time.
0 commit comments