mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 05:13:29 -05:00
Fix Building
This commit is contained in:
parent
4c5dc32a0b
commit
fe8c0350f1
3 changed files with 6 additions and 28 deletions
|
@ -23,7 +23,7 @@ import { existsSync, readdirSync } from "fs";
|
|||
import { readdir, rm, writeFile } from "fs/promises";
|
||||
import { join } from "path";
|
||||
|
||||
import { addBuild, BUILD_TIMESTAMP, buildOrWatchAll, commonOpts, commonRendererPlugins, exists, globPlugins, IS_DEV, IS_REPORTER, IS_STANDALONE, IS_UPDATER_DISABLED, resolvePluginName, VERSION, watch } from "./common.mjs";
|
||||
import { addBuild, BUILD_TIMESTAMP, buildOrWatchAll, commonOpts, exists, globPlugins, IS_DEV, IS_REPORTER, IS_STANDALONE, IS_UPDATER_DISABLED, resolvePluginName, VERSION, watch } from "./common.mjs";
|
||||
|
||||
const defines = {
|
||||
IS_STANDALONE: String(IS_STANDALONE),
|
||||
|
@ -128,7 +128,7 @@ await Promise.all([
|
|||
sourcemap,
|
||||
plugins: [
|
||||
globPlugins("discordDesktop"),
|
||||
...commonRendererPlugins
|
||||
...commonOpts.plugins
|
||||
],
|
||||
define: {
|
||||
...defines,
|
||||
|
@ -180,7 +180,7 @@ await Promise.all([
|
|||
sourcemap,
|
||||
plugins: [
|
||||
globPlugins("vencordDesktop"),
|
||||
...commonRendererPlugins
|
||||
...commonOpts.plugins
|
||||
],
|
||||
define: {
|
||||
...defines,
|
||||
|
@ -232,7 +232,7 @@ await Promise.all([
|
|||
sourcemap,
|
||||
plugins: [
|
||||
globPlugins("equicordDesktop"),
|
||||
...commonRendererPlugins
|
||||
...commonOpts.plugins
|
||||
],
|
||||
define: {
|
||||
...defines,
|
||||
|
|
|
@ -23,7 +23,7 @@ import { appendFile, mkdir, readdir, readFile, rm, writeFile } from "fs/promises
|
|||
import { join } from "path";
|
||||
import Zip from "zip-local";
|
||||
|
||||
import { addBuild, BUILD_TIMESTAMP, buildOrWatchAll, commonOpts, commonRendererPlugins, globPlugins, IS_DEV, IS_REPORTER, VERSION } from "./common.mjs";
|
||||
import { addBuild, BUILD_TIMESTAMP, buildOrWatchAll, commonOpts, globPlugins, IS_DEV, IS_REPORTER, VERSION } from "./common.mjs";
|
||||
|
||||
/**
|
||||
* @type {esbuild.BuildOptions}
|
||||
|
@ -36,7 +36,7 @@ const commonOptions: esbuild.BuildOptions = {
|
|||
external: ["~plugins", "~git-hash", "/assets/*"],
|
||||
plugins: [
|
||||
globPlugins("web"),
|
||||
...commonRendererPlugins
|
||||
...commonOpts.plugins
|
||||
],
|
||||
target: ["esnext"],
|
||||
define: {
|
||||
|
|
|
@ -28,7 +28,6 @@ import { join, relative } from "path";
|
|||
import { promisify } from "util";
|
||||
|
||||
import { getPluginTarget } from "../utils.mjs";
|
||||
import { builtinModules } from "module";
|
||||
|
||||
const PackageJSON: typeof import("../../package.json") = JSON.parse(readFileSync("package.json", "utf-8"));
|
||||
|
||||
|
@ -263,15 +262,6 @@ export const stylePlugin: Plugin = {
|
|||
}
|
||||
};
|
||||
|
||||
export const banImportPlugin = (filter: RegExp, message: string) => ({
|
||||
name: "ban-imports",
|
||||
setup: build => {
|
||||
build.onResolve({ filter }, () => {
|
||||
return { errors: [{ text: message }] };
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const commonOpts = {
|
||||
logLevel: "info",
|
||||
bundle: true,
|
||||
|
@ -312,15 +302,3 @@ export async function buildOrWatchAll() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const escapedBuiltinModules = builtinModules
|
||||
.map(m => m.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"))
|
||||
.join("|");
|
||||
const builtinModuleRegex = new RegExp(`^(node:)?(${escapedBuiltinModules})$`);
|
||||
|
||||
export const commonRendererPlugins = [
|
||||
banImportPlugin(builtinModuleRegex, "Cannot import node inbuilt modules in browser code. You need to use a native.ts file"),
|
||||
banImportPlugin(/^react$/, "Cannot import from react. React and hooks should be imported from @webpack/common"),
|
||||
banImportPlugin(/^electron(\/.*)?$/, "Cannot import electron in browser code. You need to use a native.ts file"),
|
||||
...commonOpts.plugins
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue