Skip to content

Commit

Permalink
feat(cli): allow async in capacitor config file (#4299)
Browse files Browse the repository at this point in the history
Co-authored-by: jcesarmobile <[email protected]>
  • Loading branch information
buschtoens and jcesarmobile authored Jan 23, 2024
1 parent 9adc719 commit 5cecc3e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ async function loadExtConfigTS(

const ts = require(tsPath); // eslint-disable-line @typescript-eslint/no-var-requires
const extConfigObject = requireTS(ts, extConfigFilePath) as any;
const extConfig = extConfigObject.default ?? extConfigObject;
const extConfig = extConfigObject.default
? await extConfigObject.default
: extConfigObject;

return {
extConfigType: 'ts',
Expand All @@ -157,7 +159,7 @@ async function loadExtConfigJS(
extConfigType: 'js',
extConfigName,
extConfigFilePath: extConfigFilePath,
extConfig: require(extConfigFilePath),
extConfig: await require(extConfigFilePath),
};
} catch (e: any) {
fatal(`Parsing ${c.strong(extConfigName)} failed.\n\n${e.stack ?? e}`);
Expand Down

0 comments on commit 5cecc3e

Please sign in to comment.