Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): allow async in capacitor config file #4299

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,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 @@ -136,7 +138,7 @@ async function loadExtConfigJS(
extConfigType: 'js',
extConfigName,
extConfigFilePath: extConfigFilePath,
extConfig: require(extConfigFilePath),
extConfig: await require(extConfigFilePath),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this await needed?
seems to work fine without it.
Is there a case where it would be needed?

};
} catch (e) {
fatal(`Parsing ${c.strong(extConfigName)} failed.\n\n${e.stack ?? e}`);
Expand Down