Skip to content

feat(nextjs): Document options for disabling webpack plugin #3826

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

Merged

Conversation

lobsterkatie
Copy link
Member

This PR adds docs for the options introduced in getsentry/sentry-javascript#3771, which allow the user to disable the addition of SentryWebpackPlugin to server and client builds.

@vercel
Copy link

vercel bot commented Jun 30, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sentry/sentry-docs/6uxe4Yor4iTGjDBukPwHbNhgAhWM
✅ Preview: https://sentry-docs-git-kmclb-document-disabling-webpack-plugin-eb83c9.sentry.dev

lobsterkatie added a commit to getsentry/sentry-javascript that referenced this pull request Jun 30, 2021
Despite our strong encouragement, not everyone wants to use the `SentryWebpackPlugin` to upload sourcemaps. This PR introduces two new options, `disableServerWebpackPlugin` and `disableClientWebpackPlugin`, which can be used in `next.config.js` like this:

```
const { withSentryConfig } = require("@sentry/nextjs");

const moduleExports = {
  sentry: {
    disableServerWebpackPlugin: true,
    disableClientWebpackPlugin: true,
  },
};

// unnecessary if the webpack plugin is disabled for both server and client (in that case, can also safely 
// be omitted from the `withSentryConfig` call below)
const SentryWebpackPluginOptions = {
  // ...
};

module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions);
```

Setting either of these options does two things in the relevant (server or client) config:

- prevents the SDK from forcing `webpack.devtool` to be `source-map` in production, and
- prevents the SDK from adding an instance of `SentryWebpackPlugin` to the webpack config.

These changes are documented in getsentry/sentry-docs#3826.

Fixes #3674
@lobsterkatie lobsterkatie requested review from a team, rhcarvalho, AbhiPrasad and iker-barriocanal and removed request for a team and rhcarvalho July 2, 2021 18:17
@lobsterkatie lobsterkatie force-pushed the kmclb-document-disabling-webpack-plugin-in-nextjs branch from 643649a to cb3eea2 Compare July 5, 2021 18:14
@lobsterkatie lobsterkatie merged commit bc974b6 into master Jul 6, 2021
@lobsterkatie lobsterkatie deleted the kmclb-document-disabling-webpack-plugin-in-nextjs branch July 6, 2021 13:25
@github-actions github-actions bot locked and limited conversation to collaborators Jul 22, 2021
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.

3 participants