Skip to content

Commit

Permalink
fix multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrolich committed Apr 12, 2024
1 parent 67fab5a commit 0d34763
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/bsconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,15 +348,22 @@ 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(),
}
}

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())
Expand Down

0 comments on commit 0d34763

Please sign in to comment.