fix(turbo): keep package exports fresh in dev
This commit is contained in:
parent
a77826eab9
commit
2d779165cd
5 changed files with 68 additions and 3 deletions
|
|
@ -2,6 +2,7 @@ import { readFileSync } from "node:fs";
|
|||
import { join } from "node:path";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { createDevServerConfig } from "../../vite.config";
|
||||
import { apiServerArgs } from "./dev";
|
||||
|
||||
describe("local development runtime", () => {
|
||||
test("starts the Bun API server together with the Vite dev server", () => {
|
||||
|
|
@ -22,4 +23,11 @@ describe("local development runtime", () => {
|
|||
changeOrigin: true,
|
||||
});
|
||||
});
|
||||
|
||||
test("uses development package export conditions for the Bun API server", () => {
|
||||
expect(apiServerArgs).toEqual([
|
||||
"--conditions=development",
|
||||
"src/server/index.ts",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ const webPort = process.env.PORT || "5173";
|
|||
const apiHost = process.env.DASHBOARD_DEV_API_HOST || "127.0.0.1";
|
||||
const apiPort = process.env.DASHBOARD_DEV_API_PORT || "5174";
|
||||
const apiTarget = `http://${apiHost}:${apiPort}`;
|
||||
export const apiServerArgs = [
|
||||
"--conditions=development",
|
||||
"src/server/index.ts",
|
||||
] as const;
|
||||
|
||||
if (import.meta.main) {
|
||||
runDevServers();
|
||||
|
|
@ -51,7 +55,7 @@ export function runDevServers(): void {
|
|||
process.on("SIGINT", () => shutdown(0));
|
||||
process.on("SIGTERM", () => shutdown(0));
|
||||
|
||||
spawn("api server", [process.execPath, "src/server/index.ts"], {
|
||||
spawn("api server", [process.execPath, ...apiServerArgs], {
|
||||
HOST: apiHost,
|
||||
PORT: apiPort,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue