From ebb6383990b4c93e90c04e7603dc2064e68af4d9 Mon Sep 17 00:00:00 2001 From: Jaap Frolich Date: Fri, 12 Apr 2024 17:32:06 +0200 Subject: [PATCH] fix multiple --- src/bsconfig.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/bsconfig.rs b/src/bsconfig.rs index f281a3c..9e95797 100644 --- a/src/bsconfig.rs +++ b/src/bsconfig.rs @@ -345,7 +345,10 @@ impl Config { pub fn get_module(&self) -> String { match &self.package_specs { Some(OneOrMore::Single(PackageSpec { module, .. })) => module.to_string(), - Some(OneOrMore::Multiple(_)) => panic!("Multiple package specs not supported"), + Some(OneOrMore::Multiple(vec)) => match vec.first() { + Some(PackageSpec { module, .. }) => module.to_string(), + None => "commonjs".to_string(), + }, _ => "commonjs".to_string(), } } @@ -353,7 +356,11 @@ impl Config { pub fn get_suffix(&self) -> String { match &self.package_specs { Some(OneOrMore::Single(PackageSpec { suffix, .. })) => suffix.to_owned(), - Some(OneOrMore::Multiple(_)) => panic!("Multiple package specs not supported"), + Some(OneOrMore::Multiple(vec)) => match vec.first() { + Some(PackageSpec { suffix, .. }) => suffix.to_owned(), + None => None, + }, + _ => self.suffix.to_owned(), } .unwrap_or(".js".to_string())