Skip to content

Commit ebb6383

Browse files
committed
fix multiple
1 parent 80f1252 commit ebb6383

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/bsconfig.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,22 @@ impl Config {
345345
pub fn get_module(&self) -> String {
346346
match &self.package_specs {
347347
Some(OneOrMore::Single(PackageSpec { module, .. })) => module.to_string(),
348-
Some(OneOrMore::Multiple(_)) => panic!("Multiple package specs not supported"),
348+
Some(OneOrMore::Multiple(vec)) => match vec.first() {
349+
Some(PackageSpec { module, .. }) => module.to_string(),
350+
None => "commonjs".to_string(),
351+
},
349352
_ => "commonjs".to_string(),
350353
}
351354
}
352355

353356
pub fn get_suffix(&self) -> String {
354357
match &self.package_specs {
355358
Some(OneOrMore::Single(PackageSpec { suffix, .. })) => suffix.to_owned(),
356-
Some(OneOrMore::Multiple(_)) => panic!("Multiple package specs not supported"),
359+
Some(OneOrMore::Multiple(vec)) => match vec.first() {
360+
Some(PackageSpec { suffix, .. }) => suffix.to_owned(),
361+
None => None,
362+
},
363+
357364
_ => self.suffix.to_owned(),
358365
}
359366
.unwrap_or(".js".to_string())

0 commit comments

Comments
 (0)