mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-07 21:53:04 -04:00
Add Web/Desktop specific plugin capabilities; misc fixes
This commit is contained in:
parent
3b945b87b8
commit
5d1283bd85
11 changed files with 89 additions and 85 deletions
|
@ -33,6 +33,8 @@ export const banner = {
|
|||
`.trim()
|
||||
};
|
||||
|
||||
const isWeb = process.argv.slice(0, 2).some(f => f.endsWith("buildWeb.mjs"));
|
||||
|
||||
// https://github.com/evanw/esbuild/issues/619#issuecomment-751995294
|
||||
/**
|
||||
* @type {import("esbuild").Plugin}
|
||||
|
@ -70,7 +72,13 @@ export const globPlugins = {
|
|||
for (const file of files) {
|
||||
if (file.startsWith(".")) continue;
|
||||
if (file === "index.ts") continue;
|
||||
if (!watch && (file.endsWith(".dev.ts") || file.endsWith(".dev.tsx"))) continue;
|
||||
const fileBits = file.split(".");
|
||||
if (fileBits.length > 2 && ["ts", "tsx"].includes(fileBits.at(-1))) {
|
||||
const mod = fileBits.at(-2);
|
||||
if (mod === "dev" && !watch) continue;
|
||||
if (mod === "web" && !isWeb) continue;
|
||||
if (mod === "desktop" && isWeb) continue;
|
||||
}
|
||||
|
||||
const mod = `p${i}`;
|
||||
code += `import ${mod} from "./${dir}/${file.replace(/\.tsx?$/, "")}";\n`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue