fix(dev): keep Fast Refresh enabled under process managers
This commit is contained in:
@@ -20,6 +20,7 @@ const args = process.argv.slice(2);
|
|||||||
writeFileSync(root + "/" + role + ".pid", String(process.pid));
|
writeFileSync(root + "/" + role + ".pid", String(process.pid));
|
||||||
writeFileSync(root + "/" + role + ".json", JSON.stringify({
|
writeFileSync(root + "/" + role + ".json", JSON.stringify({
|
||||||
args, target: process.env.S2S_BACKEND_URL, hosts: process.env.S2S_DEV_ALLOWED_HOSTS,
|
args, target: process.env.S2S_BACKEND_URL, hosts: process.env.S2S_DEV_ALLOWED_HOSTS,
|
||||||
|
nodeEnv: process.env.NODE_ENV,
|
||||||
}));
|
}));
|
||||||
if (process.env.S2S_TEST_FAIL === role) process.exit(37);
|
if (process.env.S2S_TEST_FAIL === role) process.exit(37);
|
||||||
const worker = spawn(process.execPath, ["-e",
|
const worker = spawn(process.execPath, ["-e",
|
||||||
@@ -95,6 +96,7 @@ async function launcher(context: TestContext, env: Record<string, string> = {})
|
|||||||
...process.env,
|
...process.env,
|
||||||
UI_PORT: String(publicPort),
|
UI_PORT: String(publicPort),
|
||||||
UI_HOST: "0.0.0.0",
|
UI_HOST: "0.0.0.0",
|
||||||
|
NODE_ENV: "production",
|
||||||
S2S_BACKEND_PORT: "1",
|
S2S_BACKEND_PORT: "1",
|
||||||
S2S_BACKEND_URL: "http://wrong-target.invalid",
|
S2S_BACKEND_URL: "http://wrong-target.invalid",
|
||||||
S2S_TEST_ROOT: root,
|
S2S_TEST_ROOT: root,
|
||||||
@@ -133,6 +135,7 @@ for (const signal of ["SIGINT", "SIGTERM"] as const) {
|
|||||||
args: ["--host", "0.0.0.0", "--port", String(run.publicPort), "--strictPort"],
|
args: ["--host", "0.0.0.0", "--port", String(run.publicPort), "--strictPort"],
|
||||||
target: `http://127.0.0.1:${run.backendPort}`,
|
target: `http://127.0.0.1:${run.backendPort}`,
|
||||||
hosts: "s2s.test",
|
hosts: "s2s.test",
|
||||||
|
nodeEnv: "development",
|
||||||
});
|
});
|
||||||
assert.equal(run.output().includes("Installing"), false);
|
assert.equal(run.output().includes("Installing"), false);
|
||||||
run.child.kill(signal);
|
run.child.kill(signal);
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ fi
|
|||||||
|
|
||||||
(
|
(
|
||||||
cd "$FRONTEND_DIR"
|
cd "$FRONTEND_DIR"
|
||||||
|
# Keep React Fast Refresh enabled even if PM2 exports NODE_ENV=production.
|
||||||
|
export NODE_ENV=development
|
||||||
exec setsid node node_modules/vite/bin/vite.js --host "$UI_HOST" --port "$UI_PORT" --strictPort
|
exec setsid node node_modules/vite/bin/vite.js --host "$UI_HOST" --port "$UI_PORT" --strictPort
|
||||||
) &
|
) &
|
||||||
frontend_pid=$!
|
frontend_pid=$!
|
||||||
|
|||||||
Reference in New Issue
Block a user