From e35c691163e157824c970ace5c9e1bee09477f32 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Thu, 5 Dec 2024 16:57:48 +0100 Subject: [PATCH] feat(nextjs): Deprecate typedef for `hideSourceMaps` (#14594) --- docs/migration/draft-v9-migration-guide.md | 4 ++++ packages/nextjs/src/config/types.ts | 3 +++ .../test/config/webpack/constructWebpackConfig.test.ts | 6 +++--- packages/nextjs/test/types/next.config.ts | 1 - 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/migration/draft-v9-migration-guide.md b/docs/migration/draft-v9-migration-guide.md index e66bca5376f8..d3b31b4f2570 100644 --- a/docs/migration/draft-v9-migration-guide.md +++ b/docs/migration/draft-v9-migration-guide.md @@ -115,6 +115,10 @@ - Deprecated `wrapUseRoutes`. Use `wrapUseRoutesV6` or `wrapUseRoutesV7` instead. - Deprecated `wrapCreateBrowserRouter`. Use `wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` instead. +## `@sentry/nextjs` + +- Deprecated `hideSourceMaps`. No replacements. The SDK emits hidden sourcemaps by default. + ## `@sentry/opentelemetry` - Deprecated `generateSpanContextForPropagationContext` in favor of doing this manually - we do not need this export anymore. diff --git a/packages/nextjs/src/config/types.ts b/packages/nextjs/src/config/types.ts index 75ce7258fae5..44dfb544654f 100644 --- a/packages/nextjs/src/config/types.ts +++ b/packages/nextjs/src/config/types.ts @@ -376,7 +376,10 @@ export type SentryBuildOptions = { /** * Use `hidden-source-map` for webpack `devtool` option, which strips the `sourceMappingURL` from the bottom of built * JS files. + * + * @deprecated This is deprecated. The SDK emits chunks without `sourceMappingURL` for client bundles by default. */ + // TODO(v9): Remove option hideSourceMaps?: boolean; /** diff --git a/packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts b/packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts index a9d8b812f8a9..20af1d99f1ce 100644 --- a/packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts +++ b/packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts @@ -68,19 +68,19 @@ describe('constructWebpackConfigFunction()', () => { expect(finalWebpackConfig?.devtool).not.toEqual('source-map'); }); - it('allows for the use of `hidden-source-map` as `devtool` value for client-side builds', async () => { + it('uses `hidden-source-map` as `devtool` value for client-side builds', async () => { const finalClientWebpackConfig = await materializeFinalWebpackConfig({ exportedNextConfig: exportedNextConfig, incomingWebpackConfig: clientWebpackConfig, incomingWebpackBuildContext: clientBuildContext, - sentryBuildTimeOptions: { hideSourceMaps: true }, + sentryBuildTimeOptions: {}, }); const finalServerWebpackConfig = await materializeFinalWebpackConfig({ exportedNextConfig: exportedNextConfig, incomingWebpackConfig: serverWebpackConfig, incomingWebpackBuildContext: serverBuildContext, - sentryBuildTimeOptions: { hideSourceMaps: true }, + sentryBuildTimeOptions: {}, }); expect(finalClientWebpackConfig.devtool).toEqual('hidden-source-map'); diff --git a/packages/nextjs/test/types/next.config.ts b/packages/nextjs/test/types/next.config.ts index 74ea16a946db..1039c99162b2 100644 --- a/packages/nextjs/test/types/next.config.ts +++ b/packages/nextjs/test/types/next.config.ts @@ -3,7 +3,6 @@ import type { NextConfig } from 'next'; import { withSentryConfig } from '../../src/config/withSentryConfig'; const config: NextConfig = { - hideSourceMaps: true, webpack: config => ({ ...config, module: {