Skip to content

Commit

Permalink
Fix config file loading
Browse files Browse the repository at this point in the history
  • Loading branch information
JumpLink committed Feb 2, 2022
1 parent ad50ef9 commit 52a07c4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,16 @@ export class Config {
'.js': async (filepath) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const file = await import(filepath)
if (file.default) {

// Files with `exports.default = { ... }`
if (file?.default?.default) {
return file.default.default as Partial<UserConfig>
}
// Files with `export default { ... }`
if (file?.default) {
return file.default as Partial<UserConfig>
}
// Files with `export { ... }`
return file as Partial<UserConfig>
},
},
Expand Down Expand Up @@ -293,11 +300,11 @@ export class Config {
config.environments = configFile.config.environments
}
// buildType
if (configFile.config.buildType) {
if (config.buildType === Config.options.buildType.default && configFile.config.buildType) {
config.buildType = configFile.config.buildType
}
// moduleType
if (configFile.config.moduleType) {
if (config.moduleType === Config.options.moduleType.default && configFile.config.moduleType) {
config.moduleType = configFile.config.moduleType
}
// verbose
Expand Down

0 comments on commit 52a07c4

Please sign in to comment.