Skip to content

Commit d2c60d1

Browse files
authored
feat(remix): Update Remix documentation. (#9425)
1 parent f82c68c commit d2c60d1

File tree

7 files changed

+79
-10
lines changed

7 files changed

+79
-10
lines changed

docs/platforms/javascript/guides/remix/manual-setup.mdx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ The two configuration types are mostly the same, except that some configuration
3232

3333
<SignInNote />
3434

35+
### Client-side Configuration
36+
3537
```typescript {tabTitle:Client} {filename: entry.client.tsx}
3638
import { useLocation, useMatches } from "@remix-run/react";
3739
import * as Sentry from "@sentry/remix";
@@ -64,6 +66,8 @@ Sentry.init({
6466
});
6567
```
6668

69+
### Server-side Configuration
70+
6771
```typescript {tabTitle:Server} {filename: entry.server.tsx}
6872
import * as Sentry from "@sentry/remix";
6973

@@ -225,13 +229,26 @@ const createSentryRequestHandler =
225229
app.all("*", createSentryRequestHandler(/* ... */));
226230
```
227231

228-
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](https://remix.run/docs/en/main/future/vite), you'll need to wait for the build loader before passing it to the wrapped handler.
232+
### Usage with Vite development mode (only for SDK versions < 7.106.0)
233+
234+
<Alert level='info'>
235+
236+
@sentry/remix version 7.106.0 introduced support for Vite development mode, so you don't need to await the build loader. It's recommended to upgrade to the latest version of @sentry/remix.
237+
238+
</Alert>
239+
240+
For SDK versions < 7.106.0, 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](https://remix.run/docs/en/main/future/vite), you'll need to wait for the build loader before passing it to the wrapped handler.
229241

230242
```diff {filename: server/index.ts}
231243
wrapExpressCreateRequestHandler(createRequestHandler)({
232-
build: vite
233-
- ? () => unstable_loadViteServerBuild(vite)
234-
+ ? await unstable_loadViteServerBuild(vite)
244+
build: viteDevServer
245+
- ? () =>
246+
- viteDevServer.ssrLoadModule(
247+
- "virtual:remix/server-build"
248+
- )
249+
+ ? await viteDevServer.ssrLoadModule(
250+
+ "virtual:remix/server-build"
251+
+ )
235252
: await import(BUILD_DIR + "/index.js"),
236253
...
237254
})

platform-includes/getting-started-install/javascript.remix.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The wizard will prompt you to log in to Sentry. It will then automatically do th
1010
- add the default `Sentry.init()` for the client in `entry.client.tsx` and the server in `entry.server.tsx`.
1111
- create `.sentryclirc` with an auth token to upload source maps (this file is automatically added to `.gitignore`).
1212
- adjust your `build` script in `package.json` to automatically upload source maps to Sentry when you build your application.
13+
- add an example page to your app to verify your Sentry setup
1314

1415
If you use [Remix future flags](https://remix.run/docs/en/main/pages/api-development-strategy#current-future-flags), the wizard will instrument your application accordingly to support Remix v2 features.
1516

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## Add Readable Stack Traces to Errors
22

3-
The Remix SDK provides a script that automatically creates a release and uploads sourcemaps. To generate sourcemaps with Remix, you need to call remix build with the `--sourcemap` option.
3+
By default, Remix will minify your JavaScript and CSS files in production. This makes it difficult to debug errors in production. To make debugging easier, you can generate source maps and upload them to Sentry.
44

5-
On release, call `sentry-upload-sourcemaps` to upload source maps and create a release. To see more details on how to use the command, call `sentry-upload-sourcemaps --help`.
5+
Depending on your build setup, you can either use [Sentry's Vite plugin](/platforms/javascript/sourcemaps/uploading/vite/) or `sentry-upload-sourcemaps` script to upload sourcemaps.
6+
7+
Please refer to the <PlatformLink to="/sourcemaps">Sourcemaps Documentation</PlatformLink>, for more information.
68

79
For more advanced configuration, you can use [`sentry-cli`](https://github.com/getsentry/sentry-cli) directly to upload sourcemaps.

platform-includes/performance/configure-sample-rate/javascript.remix.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<SignInNote />
22

3+
### Client-Side Performance Monitoring
4+
5+
Sentry's client-side performance monitoring captures `pageload` and `navigation` transactions when configured correctly. This is useful for understanding the performance of your application from the user's perspective.
6+
37
```typescript {tabTitle:Client} {filename: entry.client.tsx}
48
import { useLocation, useMatches } from "@remix-run/react";
59
import * as Sentry from "@sentry/remix";
@@ -25,6 +29,10 @@ Sentry.init({
2529
});
2630
```
2731

32+
### Server-Side Performance Monitoring
33+
34+
Sentry's server-side performance monitoring captures transactions for your Remix `loader`s, `action`s, and request handlers. You can also capture transactions for your database operations.
35+
2836
```typescript {tabTitle:Server} {filename: entry.server.tsx}
2937
import * as Sentry from "@sentry/remix";
3038

platform-includes/session-replay/install/javascript.remix.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The wizard will prompt you to log in to Sentry. It will then automatically do th
1010
- add the default `Sentry.init()` for the client in `entry.client.tsx` and the server in `entry.server.tsx`.
1111
- create `.sentryclirc` with an auth token to upload source maps (this file is automatically added to `.gitignore`).
1212
- adjust your `build` script in `package.json` to automatically upload source maps to Sentry when you build your application.
13+
- add an example page to your app to verify your Sentry setup
1314

1415
If you use [Remix future flags](https://remix.run/docs/en/main/pages/api-development-strategy#current-future-flags), the wizard will instrument your application accordingly to support Remix v2 features.
1516

platform-includes/sourcemaps/overview/javascript.remix.mdx

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,52 @@ Whenever you run the `build` script in your `package.json` source maps will be u
55

66
If you installed the SDK manually or the wizard failed, follow the steps below to manually configure source maps upload.
77

8-
### Configure Source Maps Upload
8+
### Using Vite Plugin (Recommended)
99

10-
<Alert level="info" title="Uploading sourcemaps on Vite projects">
10+
Starting from version 2.2.0, Remix supports [Vite](https://vitejs.dev/) as a build tool, and from Remix version 2.7.0 it's stable and the recommended way to build your application.
1111

12-
Starting from version 2.2.0, Remix supports [Vite](https://vitejs.dev/) as a build tool. If you use Vite to build your project, you can use the [Vite plugin](/platforms/javascript/sourcemaps/uploading/vite/) to upload source maps to Sentry. You do not need to follow the steps below.
12+
If you use Vite to build your project, you can use the [Vite plugin](/platforms/javascript/sourcemaps/uploading/vite/) to upload source maps to Sentry.
1313

14-
</Alert>
14+
First, install the plugin if you haven't already done so:
15+
16+
```bash
17+
npm install --save-dev @sentry/vite-plugin
18+
```
19+
20+
Then, add the plugin to your Vite configuration:
21+
22+
```typescript {filename:vite.config.ts}
23+
import { defineConfig } from 'vite'
24+
import { vitePlugin as remix } from "@remix-run/dev";
25+
import { sentryVitePlugin } from '@sentry/vite-plugin'
26+
27+
export default defineConfig({
28+
plugins: [
29+
remix({
30+
// ... your Remix plugin options
31+
}),
32+
sentryVitePlugin({
33+
// If you use .sentryclirc or environment variables,
34+
// you don't need to specify these options
35+
authToken: '___SENTRY_AUTH_TOKEN___',
36+
org: '___SENTRY_ORG_SLUG___',
37+
project: '___SENTRY_PROJECT_SLUG___',
38+
})
39+
],
40+
build: {
41+
sourcemaps: true,
42+
// ... rest of your Vite build options
43+
}
44+
45+
// ... rest of your Vite config
46+
})
47+
```
48+
49+
To see the full list of options, refer to the [Vite plugin documentation](https://www.npmjs.com/package/@sentry/vite-plugin).
50+
51+
### Using `sentry-upload-sourcemaps` Script
52+
53+
If you're not using Vite to build your project, you can use the `sentry-upload-sourcemaps` script to upload source maps to Sentry.
1554

1655
The Sentry Remix SDK provides a script to automatically create a release and upload source maps after you've built your project.
1756
Under the hood, it uses the [Sentry CLI](/product/cli/).

platform-includes/user-feedback/install/javascript.remix.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The wizard will prompt you to log in to Sentry. It will then automatically do th
1010
- add the default `Sentry.init()` for the client in `entry.client.tsx` and the server in `entry.server.tsx`.
1111
- create `.sentryclirc` with an auth token to upload source maps (this file is automatically added to `.gitignore`).
1212
- adjust your `build` script in `package.json` to automatically upload source maps to Sentry when you build your application.
13+
- add an example page to your app to verify your Sentry setup
1314

1415
If you use [Remix future flags](https://remix.run/docs/en/main/pages/api-development-strategy#current-future-flags), the wizard will instrument your application accordingly to support Remix v2 features.
1516

0 commit comments

Comments
 (0)