Commit c9211d8
Moves `withSentryConfig` and `SentryBuildOptions` to a new
`@sentry/nextjs/config` entry point, separating build-time code from the
SDK runtime. This matches the other framework SDKs, which expose their
build plugins on `./vite`, `./module` and `./middleware` rather than the
main entry.
`./config` resolves to CommonJS under both conditions, since
`next.config.mjs` is loaded by a plain Node ESM loader and the
build-time code resolves webpack loader and template paths with
`__dirname`, which is not defined in an ES module. Safe because the
module holds no SDK state.
```js
// next.config.mjs
- import { withSentryConfig } from '@sentry/nextjs';
+ import { withSentryConfig } from '@sentry/nextjs/config';
```
Breaks every existing `next.config`, but at the first build. Runtime
APIs untouched. Docs and the wizard need the same change.
This is a prerequisite for splitting the `node` export condition
(#22791), left for a follow-up. Serving the ESM server build to Next
breaks two things CommonJS currently hides: 87 browser-only names are
missing from the server build, and `cacheComponents` prerendering
rejects the `crypto.randomUUID()` inside `captureException`.
Refs #22791
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 8217a85 commit c9211d8
31 files changed
Lines changed: 169 additions & 50 deletions
File tree
- dev-packages/e2e-tests/test-applications
- nextjs-14
- nextjs-15-basepath
- nextjs-15-intl
- nextjs-15-t3
- nextjs-15
- nextjs-16-bun
- nextjs-16-cacheComponents
- nextjs-16-cf-workers
- nextjs-16-streaming-cacheComponents
- nextjs-16-streaming
- nextjs-16-trailing-slash
- tests
- nextjs-16-tunnel
- nextjs-16-userfeedback
- nextjs-16
- nextjs-app-dir
- nextjs-orpc
- nextjs-otlp
- nextjs-pages-dir
- nextjs-sourcemaps
- supabase-nextjs
- packages/nextjs
- src
- client
- common/utils
- edge
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1279 | 1279 | | |
1280 | 1280 | | |
1281 | 1281 | | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
1282 | 1297 | | |
1283 | 1298 | | |
1284 | 1299 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
0 commit comments