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(nextjs): Add troubleshooting section for nx #12090

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

chargome
Copy link
Member

@chargome chargome self-assigned this Dec 11, 2024
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 mydea and lforst December 11, 2024 09:38
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%) ⬇️

@@ -540,4 +540,10 @@ Learn more about fixing these caching issues in the <PlatformLink to="/sourcemap
</Expandable>
</PlatformSection>

<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
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs for integrating with Nx monorepo
2 participants