Skip to content

Commit d775d06

Browse files
committed
fix(webapp): boot Vite dev server only when NODE_ENV=development
start:local and dev:worker run the built server without NODE_ENV and must serve the build, not the Vite dev path. Also correct the loader comments on non-CORS queue routes and reword the changeset for users.
1 parent d2efc3a commit d775d06

5 files changed

Lines changed: 10 additions & 8 deletions

.changeset/vite-ignore-optional-imports.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"@trigger.dev/sdk": patch
33
---
44

5-
Annotate the optional `@ai-sdk/otel` dynamic import with `@vite-ignore` so Vite-based bundlers don't warn about an unanalyzable import.
5+
Suppress a build-time warning that could appear in Vite-based projects when the optional `@ai-sdk/otel` package is not installed.

apps/webapp/app/routes/api.v1.queues.$queueParam.concurrency.override.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ const route = createActionApiRoute(
7575
);
7676

7777
export const action = route.action;
78-
// The builder's loader handles CORS OPTIONS preflight
78+
// The builder's loader answers non-POST methods with a 405
7979
export const loader = route.loader;

apps/webapp/app/routes/api.v1.queues.$queueParam.concurrency.reset.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ const route = createActionApiRoute(
7575
);
7676

7777
export const action = route.action;
78-
// The builder's loader handles CORS OPTIONS preflight
78+
// The builder's loader answers non-POST methods with a 405
7979
export const loader = route.loader;

apps/webapp/app/routes/api.v1.queues.$queueParam.pause.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ const route = createActionApiRoute(
4646
);
4747

4848
export const action = route.action;
49-
// The builder's loader handles CORS OPTIONS preflight
49+
// The builder's loader answers non-POST methods with a 405
5050
export const loader = route.loader;

apps/webapp/server.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,14 @@ async function startServer() {
117117
const MODE = process.env.NODE_ENV;
118118

119119
// In development, Vite serves assets (and handles HMR) via middleware.
120+
// Only NODE_ENV=development boots Vite — scripts that run the built server
121+
// without NODE_ENV (start:local, dev:worker) must serve the build.
120122
const viteDevServer =
121-
MODE === "production"
122-
? undefined
123-
: await dynamicImport("vite").then((vite) =>
123+
MODE === "development"
124+
? await dynamicImport("vite").then((vite) =>
124125
vite.createServer({ server: { middlewareMode: true } })
125-
);
126+
)
127+
: undefined;
126128

127129
if (viteDevServer) {
128130
app.use(viteDevServer.middlewares);

0 commit comments

Comments
 (0)