Skip to content

Commit

Permalink
feat(remix): Add Vite custom server usage instructions.
Browse files Browse the repository at this point in the history
  • Loading branch information
onurtemizkan committed Nov 26, 2023
1 parent c63e60b commit 1122ff7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/platforms/javascript/guides/remix/manual-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
...
})
```

0 comments on commit 1122ff7

Please sign in to comment.