mirror of
https://github.com/aiclientproxy/proxycast.git
synced 2026-10-16 15:34:08 +08:00
Raise renderer smoke build heap
This commit is contained in:
@@ -2,12 +2,27 @@ process.env.LIME_ELECTRON_RENDERER = "1";
|
||||
|
||||
const { spawn } = await import("node:child_process");
|
||||
|
||||
const RENDERER_BUILD_NODE_OPTIONS = "--max-old-space-size=8192";
|
||||
|
||||
await run("npx", ["vite", "build"]);
|
||||
|
||||
function rendererBuildEnv() {
|
||||
const nodeOptions = process.env.NODE_OPTIONS ?? "";
|
||||
const hasOldSpaceSize = /(?:^|\s)--max-old-space-size(?:=|\s|$)/.test(
|
||||
nodeOptions,
|
||||
);
|
||||
return {
|
||||
...process.env,
|
||||
NODE_OPTIONS: hasOldSpaceSize
|
||||
? nodeOptions
|
||||
: [nodeOptions, RENDERER_BUILD_NODE_OPTIONS].filter(Boolean).join(" "),
|
||||
};
|
||||
}
|
||||
|
||||
function run(command, args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(command, args, {
|
||||
env: process.env,
|
||||
env: rendererBuildEnv(),
|
||||
stdio: "inherit",
|
||||
shell: process.platform === "win32",
|
||||
});
|
||||
|
||||
@@ -216,7 +216,7 @@ describe("Electron current package entrypoints", () => {
|
||||
}
|
||||
|
||||
const runtime = readFile("electron/electronRuntime.ts");
|
||||
expect(runtime).toContain('createRequire(import.meta.url)');
|
||||
expect(runtime).toContain("createRequire(import.meta.url)");
|
||||
expect(runtime).toContain('requireElectron("electron")');
|
||||
expectNoElectronRuntimeEsmImport(runtime, "electron/electronRuntime.ts");
|
||||
});
|
||||
@@ -258,6 +258,8 @@ describe("Electron current package entrypoints", () => {
|
||||
|
||||
expect(buildRenderer).toContain("LIME_ELECTRON_RENDERER");
|
||||
expect(smokeBuildRenderer).toContain("LIME_ELECTRON_RENDERER");
|
||||
expect(smokeBuildRenderer).toContain("--max-old-space-size=8192");
|
||||
expect(smokeBuildRenderer).toContain("NODE_OPTIONS");
|
||||
expect(viteConfig).toContain("base:");
|
||||
expect(viteConfig).toContain('isElectronRenderer ? "./" : undefined');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user