Skip to content

Commit f7105a7

Browse files
committed
docs(nuxt): Manual setup for beta
1 parent 683ab67 commit f7105a7

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

platform-includes/getting-started-config/javascript.nuxt.mdx

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
To set up the Sentry SDK, register the Sentry Nuxt module and initialize the SDK for client and server. At build time, the Sentry Nuxt Module looks for the following two files:
22

3-
- Client-Side: `sentry.client.config.(js|ts)` in the root containing `Sentry.init`
4-
- Server-Side: `instrument.server.mjs` in the `public` directory containing `Sentry.init`
3+
- Client-Side: `sentry.client.config.ts` in the root containing `Sentry.init`
4+
- Server-Side: `sentry.server.config.ts` in the root containing `Sentry.init`
55

66
In these files, you can specify the full range of <PlatformLink to="/configuration/options">Sentry SDK options</PlatformLink>.
77

@@ -44,40 +44,28 @@ Sentry.init({
4444
import * as Sentry from '@sentry/nuxt';
4545

4646
Sentry.init({
47-
dsn: "___PUBLIC_DSN___"
47+
dsn: "___PUBLIC_DSN___",
48+
49+
// We recommend adjusting this value in production, or using tracesSampler
50+
// for finer control
51+
tracesSampleRate: 1.0
4852
});
4953
```
5054

5155
The Nuxt `useRuntimeConfig()` does not work in the Sentry server config due to technical reasons (the config file has to
5256
be loaded before Nuxt is loaded). To be able to use `process.env` you either have to add `--env-file=.env` to your node command
53-
or use the `dotenv` package:
5457

55-
```bash {tabTitle: env-file}
56-
node --env-file=.env --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs
58+
```bash {tabTitle: node}
59+
node --env-file=.env .output/server/index.mjs
5760
```
5861

62+
or use the `dotenv` package:
5963

60-
61-
```javascript {tabTitle: dotenv} {filename:sentry.server.config.ts} {1,4}
64+
```javascript {tabTitle: Server Config} {filename:sentry.server.config.ts} {1,3}
6265
import dotenv from 'dotenv';
63-
import * as Sentry from '@sentry/nuxt';
6466

6567
dotenv.config();
6668

67-
Sentry.init({
68-
dsn: "___PUBLIC_DSN___"
69-
});
69+
// ... rest of the file
7070
```
7171

72-
2. Add an [--import flag](https://nodejs.org/api/cli.html#--importmodule) to the Node options of your `node` command you run
73-
in production (not `nuxt preview`), so the file loads before any other imports (keep in mind the `.mjs` file ending).
74-
Depending on your setup, you might need to adjust the path to the `sentry.server.config.mjs` file:
75-
76-
```json {filename:package.json} {4}
77-
{
78-
"scripts": {
79-
"preview": "nuxt preview",
80-
"start": "node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs"
81-
}
82-
}
83-
```
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<Alert level="warning">
2-
This SDK is considered **experimental and in an alpha state**. It may experience breaking changes. Please reach out on
2+
This SDK is **in an beta state**. It may experience breaking changes. Please reach out on
33
[GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback or concerns.
44
</Alert>

platform-includes/getting-started-sourcemaps/javascript.nuxt.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@ export default defineNuxtConfig({
2424
}
2525
});
2626
```
27+
28+
Nuxt sets default values for the source maps ([Nuxt docs](https://nuxt.com/docs/api/nuxt-config#sourcemap)) and the SDK currently keeps the source maps settings if they are explicitly defined.
29+
To enable this source maps setting, add the following code to you Nuxt config:
30+
31+
```javascript {filename:nuxt.config.ts} {2}
32+
export default defineNuxtConfig({
33+
sourcemap: { client: true }
34+
});
35+
```

0 commit comments

Comments
 (0)