Skip to content

Commit 0d34763

Browse files
committed
fix multiple
1 parent 67fab5a commit 0d34763

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
@@ -348,15 +348,22 @@ impl Config {
348348
pub fn get_module(&self) -> String {
349349
match &self.package_specs {
350350
Some(OneOrMore::Single(PackageSpec { module, .. })) => module.to_string(),
351-
Some(OneOrMore::Multiple(_)) => panic!("Multiple package specs not supported"),
351+
Some(OneOrMore::Multiple(vec)) => match vec.first() {
352+
Some(PackageSpec { module, .. }) => module.to_string(),
353+
None => "commonjs".to_string(),
354+
},
352355
_ => "commonjs".to_string(),
353356
}
354357
}
355358

356359
pub fn get_suffix(&self) -> String {
357360
match &self.package_specs {
358361
Some(OneOrMore::Single(PackageSpec { suffix, .. })) => suffix.to_owned(),
359-
Some(OneOrMore::Multiple(_)) => panic!("Multiple package specs not supported"),
362+
Some(OneOrMore::Multiple(vec)) => match vec.first() {
363+
Some(PackageSpec { suffix, .. }) => suffix.to_owned(),
364+
None => None,
365+
},
366+
360367
_ => self.suffix.to_owned(),
361368
}
362369
.unwrap_or(".js".to_string())

0 commit comments

Comments
 (0)