Skip to content

Commit 271ab3d

Browse files
lforstLms24
andauthored
feat(nextjs): Bump Webpack Plugin to version 2 and rework config options (#10978)
Co-authored-by: Lukas Stracke <[email protected]>
1 parent 140f017 commit 271ab3d

22 files changed

+823
-932
lines changed

MIGRATION.md

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,43 @@ The following previously deprecated API has been removed from the `@sentry/nextj
546546
- `IS_BUILD`
547547
- `isBuild`
548548

549+
#### Merging of the Sentry Webpack Plugin options and SDK Build options
550+
551+
With version 8 of the Sentry Next.js SDK, `withSentryConfig` will no longer accept 3 arguments. The second argument
552+
(holding options for the Sentry Webpack plugin) and the third argument (holding options for SDK build-time
553+
configuration) should now be passed as one:
554+
555+
```ts
556+
// OLD
557+
const nextConfig = {
558+
// Your Next.js options...
559+
};
560+
561+
module.exports = withSentryConfig(
562+
nextConfig,
563+
{
564+
// Your Sentry Webpack Plugin Options...
565+
},
566+
{
567+
// Your Sentry SDK options...
568+
},
569+
);
570+
571+
// NEW
572+
const nextConfig = {
573+
// Your Next.js options...
574+
};
575+
576+
module.exports = withSentryConfig(nextConfig, {
577+
// Your Sentry Webpack Plugin Options...
578+
// AND your Sentry SDK options...
579+
});
580+
```
581+
549582
#### Removal of the `sentry` property in your Next.js options (next.config.js)
550583

551584
With version 8 of the Sentry Next.js SDK, the SDK will no longer support passing Next.js options with a `sentry`
552-
property to `withSentryConfig`. Please use the third argument of `withSentryConfig` to configure the SDK instead:
585+
property to `withSentryConfig`. Please use the second argument of `withSentryConfig` to configure the SDK instead:
553586

554587
```ts
555588
// v7
@@ -572,21 +605,25 @@ const nextConfig = {
572605
// Your Next.js options...
573606
};
574607

575-
module.exports = withSentryConfig(
576-
nextConfig,
577-
{
578-
// Your Sentry Webpack Plugin Options...
579-
},
580-
{
581-
// Your Sentry SDK options...
582-
},
583-
);
608+
module.exports = withSentryConfig(nextConfig, {
609+
// Your Sentry Webpack Plugin Options...
610+
// AND your Sentry SDK options...
611+
});
584612
```
585613

586614
The reason for this change is to have one consistent way of defining the SDK options. We hope that this change will
587615
reduce confusion when setting up the SDK, with the upside that the explicit option is properly typed and will therefore
588616
have code completion.
589617

618+
#### Updated the `@sentry/webpack-plugin` dependency to version 2
619+
620+
We bumped the internal usage of `@sentry/webpack-plugin` to a new major version. This comes with multiple upsides like a
621+
simpler configuration interface and the use of new state of the art Debug ID technology. Debug IDs will simplify the
622+
setup for source maps in Sentry and will not require you to match stack frame paths to uploaded artifacts anymore.
623+
624+
To see the new options, check out the docs at https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/,
625+
or look at the TypeScript type definitions of `withSentryConfig`.
626+
590627
### Astro SDK
591628

592629
#### Removal of `trackHeaders` option for Astro middleware

packages/nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"@sentry/types": "8.0.0-alpha.2",
4343
"@sentry/utils": "8.0.0-alpha.2",
4444
"@sentry/vercel-edge": "8.0.0-alpha.2",
45-
"@sentry/webpack-plugin": "1.21.0",
45+
"@sentry/webpack-plugin": "2.14.3",
4646
"chalk": "3.0.0",
4747
"resolve": "1.22.8",
4848
"rollup": "2.78.0",

packages/nextjs/src/config/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export type { SentryWebpackPluginOptions } from './types';
21
export { withSentryConfig } from './withSentryConfig';

0 commit comments

Comments
 (0)