From 16a45167da6bb7da9641158fc668ec1aa24eed2a Mon Sep 17 00:00:00 2001 From: Vianney MORAIN Date: Wed, 17 Jun 2026 15:32:21 +0200 Subject: [PATCH] fix(e2e): support standard Vite build output in serve-built-remix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit serve-built-remix.ts expected the Vercel preset build format (build/server//index.js). Since vite.config.ts skips vercelPreset() for non-Vercel builds, the output is now build/server/index.js directly, with build/server/assets/ as a subdirectory — causing the script to try to import assets/index.js (ERR_MODULE_NOT_FOUND). Check for index.js at the root of build/server/ first; fall back to the hash-subdirectory format for Vercel preset builds. Co-Authored-By: Claude Sonnet 4.6 --- apps/builder/e2e/serve-built-remix.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/builder/e2e/serve-built-remix.ts b/apps/builder/e2e/serve-built-remix.ts index b239d6818c1b..84ac84be21d6 100644 --- a/apps/builder/e2e/serve-built-remix.ts +++ b/apps/builder/e2e/serve-built-remix.ts @@ -2,7 +2,7 @@ import { installGlobals } from "@remix-run/node"; import { createRequestHandler as createExpressRequestHandler } from "@remix-run/express"; import type { ServerBuild } from "@remix-run/server-runtime"; import express from "express"; -import { readdirSync, readFileSync } from "node:fs"; +import { existsSync, readdirSync, readFileSync } from "node:fs"; import https from "node:https"; import path from "node:path"; import { pathToFileURL } from "node:url"; @@ -11,6 +11,14 @@ installGlobals({ nativeFetch: true }); const resolveServerBuildPath = () => { const serverDirectory = path.resolve("build/server"); + + // Standard Vite build (no vercelPreset): index.js is at the root of build/server/ + const directEntry = path.join(serverDirectory, "index.js"); + if (existsSync(directEntry)) { + return directEntry; + } + + // Vercel preset build: index.js lives inside a hash-named subdirectory const serverBuild = readdirSync(serverDirectory, { withFileTypes: true, }).find((entry) => entry.isDirectory());