Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(nuxt): Add troubleshoot pnpm #11720

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions platform-includes/getting-started-config/javascript.nuxt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ dotenv.config();

After adding `sentry.server.config.ts` and building the project, you might get an error like this:
`Failed to register ESM hook import-in-the-middle/hook.mjs`. You can add an override (npm/pnpm) or a resolution (yarn)
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).
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).


Nitro updated `@vercel/nft` in Nitro version `2.10.0`, so you might not get this error anymore, and you don't need to
add this override/resolution.

```json {tabTitle:npm} {filename:package.json}
"overrides": {
Expand All @@ -99,3 +102,17 @@ See the [underlying issue in the UnJS Nitro project](https://github.com/unjs/nit
}
}
```

**Pnpm and Import-In-The-Middle**

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.
As pnpm implements a strict dependency isolation, this import might cause problems.
Per default, `shamefully-hoist` is `false` ([pnpm docs here](https://pnpm.io/next/npmrc#shamefully-hoist)) and this prevents accessing non-declared dependencies.
You probably don't want to change this setting, so you have to explicitly add the dependency `import-in-the-middle`:

```json {tabTitle:pnpm} {filename:package.json}
// only when using pnpm
"dependencies": {
"import-in-the-middle": "^1.11.2"
}
```
Loading