Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(remix): Add Vite custom server usage instructions. #8576

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"),
...
})
```