Skip to content

Commit e52c1e4

Browse files
committed
fix: error when vault.json is not present in module
1 parent 66c266d commit e52c1e4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

module.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,13 @@ export class RemoteModuleInstance extends ModuleInstance<RemoteModule> {
327327

328328
export class LocalModuleInstance extends ModuleInstance<LocalModule> implements MixinLoader {
329329
public async loadProviders() {
330-
const vault = await fetchJson<_Vault>(this.getRelPath("vault.json")!);
331-
const provider = vault.modules;
330+
const vault = await fetchJson<_Vault>(this.getRelPath("vault.json")!).catch(() => null);
331+
const provider = vault?.modules ?? {};
332332

333-
// TODO: revisit this check
334-
Object.keys(provider).filter((i) => i.startsWith(this.getModuleIdentifier())).forEach(async (
335-
identifier,
336-
) => this.module.newChild(identifier, provider[identifier]));
333+
Object.keys(provider)
334+
// TODO: revisit this check
335+
.filter((i) => i.startsWith(this.getModuleIdentifier()))
336+
.forEach(async (identifier) => this.module.newChild(identifier, provider[identifier]));
337337
}
338338

339339
private _transformer = createTransformer(this);

0 commit comments

Comments
 (0)