Skip to content

Commit 0e0caf5

Browse files
chargomebitsandfoxes
authored andcommitted
docs(js): Update react-router docs for import flags (#14107)
1 parent ba05f7a commit 0e0caf5

File tree

1 file changed

+18
-0
lines changed
  • docs/platforms/javascript/guides/react-router

1 file changed

+18
-0
lines changed

docs/platforms/javascript/guides/react-router/index.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,24 @@ Update the `start` and `dev` script to include the instrumentation file:
373373
}
374374
```
375375

376+
#### Alternative Setup for Hosting Platforms
377+
378+
If you're deploying to platforms like **Vercel** or **Netlify** where setting the `NODE_OPTIONS` import flag is not possible, you can import the instrumentation file directly at the top of your `entry.server.tsx`:
379+
380+
```tsx {diff} {filename: entry.server.tsx}
381+
+import './instrument.server';
382+
import * as Sentry from '@sentry/react-router';
383+
import { createReadableStreamFromReadable } from '@react-router/node';
384+
import { renderToPipeableStream } from 'react-dom/server';
385+
// ... rest of your imports
386+
```
387+
388+
<Alert title="Incomplete Auto-instrumentation" level="warning">
389+
390+
When importing the instrumentation file directly in `entry.server.tsx` instead of using the `--import` flag, automatic instrumentation will be incomplete and you'll miss automatically captured spans and traces for some of your application's server-side operations. This approach should only be used when the `NODE_OPTIONS` approach is not available on your hosting platform.
391+
392+
</Alert>
393+
376394
## Source Maps Upload
377395

378396
Update `vite.config.ts` to include the `sentryReactRouter` plugin, making sure to pass both the Vite and Sentry configurations to it:

0 commit comments

Comments
 (0)