|
10 | 10 |
|
11 | 11 | - "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
|
12 | 12 |
|
| 13 | +- **feat(solidstart): Default to `--import` setup and add `autoInjectServerSentry` ([#14862](https://github.com/getsentry/sentry-javascript/pull/14862))** |
| 14 | + |
| 15 | +To enable the SolidStart SDK, wrap your SolidStart Config with `withSentry`. The `sentrySolidStartVite` plugin is now automatically |
| 16 | +added by `withSentry` and you can pass the Sentry build-time options like this: |
| 17 | + |
| 18 | +```js |
| 19 | +import { defineConfig } from '@solidjs/start/config'; |
| 20 | +import { withSentry } from '@sentry/solidstart'; |
| 21 | + |
| 22 | +export default defineConfig( |
| 23 | + withSentry( |
| 24 | + { |
| 25 | + /* Your SolidStart config options... */ |
| 26 | + }, |
| 27 | + { |
| 28 | + // Options for setting up source maps |
| 29 | + org: process.env.SENTRY_ORG, |
| 30 | + project: process.env.SENTRY_PROJECT, |
| 31 | + authToken: process.env.SENTRY_AUTH_TOKEN, |
| 32 | + }, |
| 33 | + ), |
| 34 | +); |
| 35 | +``` |
| 36 | + |
| 37 | +With the `withSentry` wrapper, the Sentry server config should not be added to the `public` directory anymore. |
| 38 | +Add the Sentry server config in `src/instrument.server.ts`. Then, the server config will be placed inside the server build output as `instrument.server.mjs`. |
| 39 | + |
| 40 | +Now, there are two options to set up the SDK: |
| 41 | + |
| 42 | +1. **(recommended)** Provide an `--import` CLI flag to the start command like this (path depends on your server setup): |
| 43 | + `node --import ./.output/server/instrument.server.mjs .output/server/index.mjs` |
| 44 | +2. Add `autoInjectServerSentry: 'top-level-import'` and the Sentry config will be imported at the top of the server entry (comes with tracing limitations) |
| 45 | + ```js |
| 46 | + withSentry( |
| 47 | + { |
| 48 | + /* Your SolidStart config options... */ |
| 49 | + }, |
| 50 | + { |
| 51 | + // Optional: Install Sentry with a top-level import |
| 52 | + autoInjectServerSentry: 'top-level-import', |
| 53 | + }, |
| 54 | + ); |
| 55 | + ``` |
| 56 | + |
13 | 57 | ## 8.51.0
|
14 | 58 |
|
15 | 59 | ### Important Changes
|
|
0 commit comments