Skip to content

Conversation

@chargome
Copy link
Member

@chargome chargome self-assigned this Dec 11, 2024
@vercel
Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 2:03pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Visit Preview Dec 11, 2024 2:03pm
develop-docs ⬜️ Ignored (Inspect) Visit Preview Dec 11, 2024 2:03pm

@chargome chargome requested review from lforst and mydea December 11, 2024 09:38
@codecov
Copy link

codecov bot commented Dec 11, 2024

Bundle Report

Changes will decrease total bundle size by 15 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 10.34MB 9 bytes (-0.0%) ⬇️
sentry-docs-client-array-push 9.27MB 6 bytes (-0.0%) ⬇️

<PlatformSection supported={['javascript.nextjs']}>
<Expandable permalink title="Using the Sentry Next SDK in a Nx monorepo">
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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).
To set up Sentry's Next.js SDK in an Nx monorepo, please refer to [this guide](https://nx.dev/recipes/next/next-config-setup#manually-composing-plugins-nx-15-and-prior).

The guide above is actually harmful af 🤦

I would almost put this code snippet here:

// next.config.js

const nextConfig = {
  // ...
};

const plugins = [
  // Your plugins excluding withNx
];

module.exports = async (phase, context) => {
  let updatedConfig = plugins.reduce((acc, fn) => fn(acc), nextConfig);

  // Apply the async function that `withNx` returns.
  updatedConfig = await withNx(updatedConfig)(phase, context);

  return updatedConfig;
};

// The Sentry plugin should always be applied last
const { withSentryConfig } = require('@sentry/nextjs');
module.exports = withSentryConfig(module.exports)

@chargome chargome merged commit 887b408 into master Dec 11, 2024
11 checks passed
@chargome chargome deleted the cg/next-nx-troubleshooting branch December 11, 2024 15:22
@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs for integrating with Nx monorepo

3 participants