diff --git a/aptos-move/framework/src/built_package.rs b/aptos-move/framework/src/built_package.rs index e3b2ced1d0227..dd8d12d765969 100644 --- a/aptos-move/framework/src/built_package.rs +++ b/aptos-move/framework/src/built_package.rs @@ -472,16 +472,17 @@ impl BuiltPackage { .package .deps_compiled_units .iter() - .map(|(name, unit)| { - let package_name = name.as_str().to_string(); - let account = match &unit.unit { - CompiledUnit::Module(m) => AccountAddress::new(m.address.into_bytes()), - _ => panic!("script not a dependency"), - }; - PackageDep { - account, - package_name, - } + .flat_map(|(name, unit)| match &unit.unit { + CompiledUnit::Module(m) => { + let package_name = name.as_str().to_string(); + let account = AccountAddress::new(m.address.into_bytes()); + + Some(PackageDep { + account, + package_name, + }) + }, + CompiledUnit::Script(_) => None, }) .collect::>() .into_iter()