Skip to content

Commit b62c5d6

Browse files
committed
add snippet
1 parent f594e95 commit b62c5d6

File tree

1 file changed

+36
-12
lines changed
  • docs/platforms/javascript/common/troubleshooting

1 file changed

+36
-12
lines changed

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

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -437,22 +437,22 @@ Learn more about fixing these caching issues in the <PlatformLink to="/sourcemap
437437
<PlatformSection notSupported={['javascript.nuxt']}>
438438
<Expandable permalink title="pnpm: Resolving 'import-in-the-middle' external package errors">
439439
440-
When using pnpm, you might encounter errors related to packages that can't be external, particularly with packages like `import-in-the-middle` and `require-in-the-middle`. These errors typically occur due to pnpm's strict dependency management and hoisting behavior.
440+
When using pnpm, you might encounter errors related to packages that can't be external, particularly with packages like `import-in-the-middle` and `require-in-the-middle`. These errors typically occur due to pnpm's strict dependency management and hoisting behavior.
441441
442-
While adding these packages as direct dependencies might remove the warning messages, it often doesn't resolve the underlying functionality issues:
442+
While adding these packages as direct dependencies might remove the warning messages, it often doesn't resolve the underlying functionality issues:
443443
444-
```bash
445-
pnpm add import-in-the-middle require-in-the-middle
446-
```
444+
```bash
445+
pnpm add import-in-the-middle require-in-the-middle
446+
```
447447
448-
As a workaround, create or modify `.npmrc` in your project root:
448+
As a workaround, create or modify `.npmrc` in your project root:
449449
450-
```npmrc
451-
shamefully-hoist=true
452-
```
453-
<Alert level="warning">
450+
```npmrc
451+
shamefully-hoist=true
452+
```
453+
<Alert level="warning">
454454
**Note**: While `shamefully-hoist=true` usually isn't the ideal solution from a dependency management perspective, it's sometimes necessary for compatibility with certain packages that expect Node.js module resolution behavior similar to npm or yarn.
455-
</Alert>
455+
</Alert>
456456
457457
458458
</Expandable>
@@ -542,7 +542,31 @@ Learn more about fixing these caching issues in the <PlatformLink to="/sourcemap
542542
543543
<PlatformSection supported={['javascript.nextjs']}>
544544
<Expandable permalink title="Using the Sentry Next SDK in a Nx monorepo (using `@nx/next`)">
545-
If you want to set up Sentry's Next.js SDK in an Nx monorepo context, please refer to [this guide](https://nx.dev/recipes/next/next-config-setup#manually-composing-plugins-nx-15-and-prior).
545+
To set up Sentry's Next.js SDK in an Nx monorepo context, consider the following setup:
546+
547+
```js {filename:next.config.js}
548+
const nextConfig = {
549+
// ...
550+
};
551+
552+
const plugins = [
553+
// Your plugins excluding withNx
554+
];
555+
556+
module.exports = async (phase, context) => {
557+
let updatedConfig = plugins.reduce((acc, fn) => fn(acc), nextConfig);
558+
559+
// Apply the async function that `withNx` returns.
560+
updatedConfig = await withNx(updatedConfig)(phase, context);
561+
562+
return updatedConfig;
563+
};
564+
565+
// The Sentry plugin should always be applied last
566+
const { withSentryConfig } = require('@sentry/nextjs');
567+
module.exports = withSentryConfig(module.exports)
568+
```
569+
546570
</Expandable>
547571
</PlatformSection>
548572

0 commit comments

Comments
 (0)