[Plugins] Tidy import code

This commit is contained in:
Beef 2023-02-19 22:35:53 +00:00
parent 6e75d64c05
commit a039d183b7

View file

@ -30,12 +30,10 @@ export async function fetchPlugin(id: string) {
try { try {
// by polymanifest spec, plugins should always specify their main file, but just in case // by polymanifest spec, plugins should always specify their main file, but just in case
pluginJs = await (await safeFetch(id + (pluginManifest.main || "index.js"), { cache: "no-store" })).text(); pluginJs = await (await safeFetch(id + (pluginManifest.main || "index.js"), { cache: "no-store" })).text();
} catch { } catch {} // Empty catch, checked below
throw new Error(`Failed to fetch JS for ${id}`);
} }
if (pluginJs.length === 0) throw new Error(`Failed to fetch JS for ${id}`); if (!pluginJs && !existingPlugin) throw new Error(`Failed to fetch JS for ${id}`);
}
plugins[id] = { plugins[id] = {
id: id, id: id,