Skip to content

Commit df405f2

Browse files
s1gr1dcoolguyzone
andauthored
docs(nuxt): Add troubleshoot pnpm (#11720)
* docs(nuxt): Add troubleshoot pnpm * Update platform-includes/getting-started-config/javascript.nuxt.mdx Co-authored-by: Alex Krawiec <[email protected]> --------- Co-authored-by: Alex Krawiec <[email protected]>
1 parent 974baee commit df405f2

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ dotenv.config();
7777

7878
After adding `sentry.server.config.ts` and building the project, you might get an error like this:
7979
`Failed to register ESM hook import-in-the-middle/hook.mjs`. You can add an override (npm/pnpm) or a resolution (yarn)
80-
for `@vercel/nft` to fix this. This will add the `hook.mjs` file to your build output.
81-
See the [underlying issue in the UnJS Nitro project](https://github.com/unjs/nitro/issues/2703).
80+
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).
81+
82+
83+
Nitro updated `@vercel/nft` in Nitro version `2.10.0`, so you might not get this error anymore, and you don't need to
84+
add this override/resolution.
8285

8386
```json {tabTitle:npm} {filename:package.json}
8487
"overrides": {
@@ -99,3 +102,17 @@ See the [underlying issue in the UnJS Nitro project](https://github.com/unjs/nit
99102
}
100103
}
101104
```
105+
106+
**Pnpm and Import-In-The-Middle**
107+
108+
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.
109+
As pnpm implements a strict dependency isolation, this import might cause problems.
110+
Per default, `shamefully-hoist` is `false` ([pnpm docs here](https://pnpm.io/next/npmrc#shamefully-hoist)) and this prevents accessing non-declared dependencies.
111+
You probably don't want to change this setting, so you have to explicitly add the dependency `import-in-the-middle`:
112+
113+
```json {tabTitle:pnpm} {filename:package.json}
114+
// only when using pnpm
115+
"dependencies": {
116+
"import-in-the-middle": "^1.11.2"
117+
}
118+
```

0 commit comments

Comments
 (0)