Skip to content

Commit 9e5fd4b

Browse files
committed
update
1 parent 3145ba6 commit 9e5fd4b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/cli/src/actions/action-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export async function loadPluginModule(provider: string, basePath: string) {
244244
const importAsEsm = async (spec: string) => {
245245
try {
246246
const result = (await import(spec)).default as CliPlugin;
247-
return typeof result.generate === 'function' ? result : undefined;
247+
return typeof result?.generate === 'function' ? result : undefined;
248248
} catch (err) {
249249
throw new CliError(`Failed to load plugin module from ${spec}: ${(err as Error).message}`);
250250
}
@@ -254,7 +254,7 @@ export async function loadPluginModule(provider: string, basePath: string) {
254254
const importAsTs = async (spec: string) => {
255255
try {
256256
const result = (await jiti.import(spec, { default: true })) as CliPlugin;
257-
return typeof result.generate === 'function' ? result : undefined;
257+
return typeof result?.generate === 'function' ? result : undefined;
258258
} catch (err) {
259259
throw new CliError(`Failed to load plugin module from ${spec}: ${(err as Error).message}`);
260260
}

0 commit comments

Comments
 (0)