*globby needs to be imported dynamically
This commit is contained in:
parent
4d00de2b40
commit
d0b65f4dc2
|
@ -1,10 +1,11 @@
|
||||||
import { globby } from "globby";
|
|
||||||
import config from "./config.js";
|
import config from "./config.js";
|
||||||
import { getRpcServer } from "./rpc/server.js";
|
import { getRpcServer } from "./rpc/server.js";
|
||||||
import { PluginAPI, RPCMethod, Plugin } from "./types.js";
|
import { PluginAPI, RPCMethod, Plugin } from "./types.js";
|
||||||
import slugify from "slugify";
|
import slugify from "slugify";
|
||||||
|
import { dynImport } from "./util";
|
||||||
|
|
||||||
let pluginApi: PluginApiManager;
|
let pluginApi: PluginApiManager;
|
||||||
|
let globby: typeof import("globby").globby;
|
||||||
|
|
||||||
const sanitizeName = (name: string) =>
|
const sanitizeName = (name: string) =>
|
||||||
slugify(name, { lower: true, strict: true });
|
slugify(name, { lower: true, strict: true });
|
||||||
|
@ -68,6 +69,7 @@ export function getPluginAPI(): PluginApiManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadPlugins() {
|
export async function loadPlugins() {
|
||||||
|
globby = ((await dynImport("globby")) as typeof import("globby")).globby;
|
||||||
for (const plugin of config.array("plugins")) {
|
for (const plugin of config.array("plugins")) {
|
||||||
await getPluginAPI().loadPlugin(plugin);
|
await getPluginAPI().loadPlugin(plugin);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue