mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-09 14:43:03 -04:00
Fix Building
This commit is contained in:
parent
4c5dc32a0b
commit
fe8c0350f1
3 changed files with 6 additions and 28 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue