Skip to content

Commit 02beedc

Browse files
s1gr1dLms24
authored andcommitted
feat(nuxt): Improve docs based on feedback (#12002)
* feat(nuxt): Improve docs based on feedback * add tilde * add 'hidden' explanation * delete org and project from wizard * fix formatting * liza review suggestions
1 parent 5532180 commit 02beedc

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

docs/platforms/javascript/common/troubleshooting/index.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ Learn more about fixing these caching issues in the <PlatformLink to="/sourcemap
459459
</PlatformSection>
460460
461461
<PlatformSection supported={['javascript.nuxt']}>
462-
<Expandable title="'import-in-the-middle' error during startup">
462+
<Expandable title="Failed to register 'import-in-the-middle' during build time">
463463
After adding `sentry.server.config.ts` and building the project, you might get an error like this:
464464
`Failed to register ESM hook import-in-the-middle/hook.mjs`. You can add an override (npm/pnpm) or a resolution (yarn)
465465
for `@vercel/nft` to fix this. This will add the `hook.mjs` file to your build output. See the [underlying issue in the UnJS Nitro project](https://github.com/unjs/nitro/issues/2703).
@@ -483,14 +483,14 @@ Learn more about fixing these caching issues in the <PlatformLink to="/sourcemap
483483
```json {tabTitle:pnpm} {filename:package.json}
484484
"pnpm": {
485485
"overrides": {
486-
"@vercel/nft": "^0.27.4"
486+
"@vercel/nft": "^0.27.4"
487+
}
487488
}
488-
}
489489
```
490490
491491
</Expandable>
492492
493-
<Expandable permalink title="pnpm: Resolving 'import-in-the-middle' external package errors">
493+
<Expandable title="pnpm dev: Cannot find package 'import-in-the-middle'">
494494
495495
Sentry injects `import "import-in-the-middle/hook.mjs"` in your server entry. This import acts as a hint for node bundlers to really include this file.
496496
As pnpm implements a strict dependency isolation, this import might cause problems.
@@ -517,22 +517,22 @@ Learn more about fixing these caching issues in the <PlatformLink to="/sourcemap
517517
518518
```json {tabTitle:npm} {filename:package.json}
519519
"overrides": {
520-
"nitropack": "2.9.7",
520+
"nitropack": "~2.9.7",
521521
"@vercel/nft": "^0.27.4"
522522
}
523523
```
524524
525525
```json {tabTitle:yarn} {filename:package.json}
526526
"resolutions": {
527-
"nitropack": "2.9.7",
527+
"nitropack": "~2.9.7",
528528
"@vercel/nft": "^0.27.4"
529529
}
530530
```
531531
532532
```json {tabTitle:pnpm} {filename:package.json}
533533
"pnpm": {
534534
"overrides": {
535-
"nitropack": "2.9.7",
535+
"nitropack": "~2.9.7",
536536
"@vercel/nft": "^0.27.4"
537537
}
538538
}

docs/platforms/javascript/guides/nuxt/install/dynamic-import.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ We are working on figuring this out ([see issue here](https://github.com/getsent
3333

3434
```json {tabTitle:npm} {filename:package.json}
3535
"overrides": {
36-
"nitropack": "2.9.7",
36+
"nitropack": "~2.9.7",
3737
"@vercel/nft": "^0.27.4"
3838
}
3939
```
4040
```json {tabTitle:yarn} {filename:package.json}
4141
"resolutions": {
42-
"nitropack": "2.9.7",
42+
"nitropack": "~2.9.7",
4343
"@vercel/nft": "^0.27.4"
4444
}
4545
```
4646
```json {tabTitle:pnpm} {filename:package.json}
4747
"pnpm": {
4848
"overrides": {
49-
"nitropack": "2.9.7",
49+
"nitropack": "~2.9.7",
5050
"@vercel/nft": "^0.27.4"
5151
}
5252
}

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ Add a `sentry.client.config.ts` file to the root of your project (this is probab
8282
import * as Sentry from '@sentry/nuxt';
8383

8484
Sentry.init({
85-
// If set up, you can use your runtime config here
86-
// dsn: useRuntimeConfig().public.sentry.dsn,
85+
// If set up, you can use the Nuxt runtime config here
86+
// dsn: useRuntimeConfig().public.sentry.dsn, // modify, depending on your custom runtime config
8787
dsn: "___PUBLIC_DSN___",
8888

8989
// We recommend adjusting this value in production, or using tracesSampler
@@ -161,16 +161,24 @@ export default defineNuxtConfig({
161161
});
162162
```
163163

164-
To upload source maps, the Sentry Nuxt Module will automatically enable source map generation in your project if it is not already enabled.
165-
However, you need to explicitly enable source map generation on the client-side. To do this, add the following code to your Nuxt configuration:
164+
The Sentry Nuxt Module automatically enables source map generation for your project,
165+
but you'll need to enable it explicitly for the client-side. Add this code to your Nuxt configuration:
166166

167167
```javascript {filename:nuxt.config.ts} {2}
168168
export default defineNuxtConfig({
169-
sourcemap: { client: true }
169+
sourcemap: { client: 'hidden' }
170170
});
171171
```
172172

173-
This step is necessary because Nuxt sets default values for source maps ([Nuxt docs](https://nuxt.com/docs/api/nuxt-config#sourcemap)), and the Sentry Nuxt Module keeps these settings when they are explicitly defined.
173+
The 'hidden' option functions the same as `true`, by enabling source map generation, but it also suppresses the source map reference comments that would
174+
normally appear at the end of each generated file in the build output. This keeps the source maps available without exposing their references in the files.
175+
176+
When you open browser developer tools, browsers try to fetch source maps using reference comments in bundled files. If source maps are uploaded to Sentry and
177+
removed from the client-side, these references cause 404 errors in developer tools. The `'hidden'` option stops these comments from being generated, preventing browsers
178+
from trying to fetch missing files and avoiding unnecessary errors.
179+
180+
You need to explicitly enable client-side source maps because Nuxt applies default [source map settings](https://nuxt.com/docs/api/nuxt-config#sourcemap), and
181+
the Sentry Nuxt Module respects these when they are explicitly defined.
174182

175183
## Verify
176184

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
We recommend installing the SDK by running our installation wizard in the root directory of your project:
22

33
```bash
4-
npx @sentry/wizard@latest -i nuxt --org ___ORG_SLUG___ --project ___PROJECT_SLUG___
4+
npx @sentry/wizard@latest -i nuxt
55
```
66

77
The wizard will prompt you to log in to Sentry. It will then automatically do the following steps for you:

0 commit comments

Comments
 (0)