From 312c6f7c47e1610c2cd41b1d7c1d88e4f4626a72 Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Mon, 27 Nov 2023 17:12:17 +0000 Subject: [PATCH] feat(remix): Add Vite custom server usage instructions. (#8576) --- .../javascript/guides/remix/manual-setup.mdx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/platforms/javascript/guides/remix/manual-setup.mdx b/src/platforms/javascript/guides/remix/manual-setup.mdx index 32fb97c1e541b..e01b541638574 100644 --- a/src/platforms/javascript/guides/remix/manual-setup.mdx +++ b/src/platforms/javascript/guides/remix/manual-setup.mdx @@ -208,6 +208,17 @@ import { createRequestHandler } from "@remix-run/express"; const createSentryRequestHandler = wrapExpressCreateRequestHandler(createRequestHandler); -// Use createSentryRequestHandler like you would with createRequestHandler app.all("*", createSentryRequestHandler(/* ... */)); ``` + +The function returned by `wrapExpressCreateRequestHandler` accepts the build object as its first parameter. So if your boilerplate code passes the argument as a function, you need to update the usage. For example, if you're using Vite, you need to await the build loader before passing it to the wrapped handler. + +```diff {filename: server/index.ts} + wrapExpressCreateRequestHandler(createRequestHandler)({ + build: vite +- ? () => unstable_loadViteServerBuild(vite) ++ ? await unstable_loadViteServerBuild(vite) + : await import(BUILD_DIR + "/index.js"), + ... + }) +```