Skip to content

Commit

Permalink
feat(nextjs): Deprecate typedef for hideSourceMaps (#14594)
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst authored Dec 5, 2024
1 parent c696aac commit e35c691
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/migration/draft-v9-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions packages/nextjs/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 0 additions & 1 deletion packages/nextjs/test/types/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { NextConfig } from 'next';
import { withSentryConfig } from '../../src/config/withSentryConfig';

const config: NextConfig = {
hideSourceMaps: true,
webpack: config => ({
...config,
module: {
Expand Down

0 comments on commit e35c691

Please sign in to comment.