Skip to content

Commit 3c39c37

Browse files
committed
Revert "fix(nextjs): Avoid importing SentryWebpackPlugin in dev mode (#8557)"
This reverts commit 0ca7389.
1 parent 825fa94 commit 3c39c37

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

packages/nextjs/src/config/webpack.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/* eslint-disable complexity */
22
/* eslint-disable max-lines */
33
import { getSentryRelease } from '@sentry/node';
4-
import { arrayify, dropUndefinedKeys, escapeStringForRegex, loadModule, logger } from '@sentry/utils';
4+
import { arrayify, dropUndefinedKeys, escapeStringForRegex, logger } from '@sentry/utils';
5+
import { default as SentryWebpackPlugin } from '@sentry/webpack-plugin';
56
import * as chalk from 'chalk';
67
import * as fs from 'fs';
78
import * as path from 'path';
@@ -312,11 +313,8 @@ export function constructWebpackConfigFunction(
312313
// without, the option to use `hidden-source-map` only applies to the client-side build.
313314
newConfig.devtool = userSentryOptions.hideSourceMaps && !isServer ? 'hidden-source-map' : 'source-map';
314315

315-
const SentryWebpackPlugin = loadModule('@sentry/webpack-plugin');
316-
317316
newConfig.plugins = newConfig.plugins || [];
318317
newConfig.plugins.push(
319-
// @ts-expect-error - this exists, the dynamic import just doesn't know about it
320318
new SentryWebpackPlugin(
321319
getWebpackPluginOptions(buildContext, userSentryWebpackPluginOptions, userSentryOptions),
322320
),
@@ -769,9 +767,6 @@ function shouldEnableWebpackPlugin(buildContext: BuildContext, userSentryOptions
769767
// architecture-specific version of the `sentry-cli` binary. If `yarn install`, `npm install`, or `npm ci` are run
770768
// with the `--ignore-scripts` option, this will be blocked and the missing binary will cause an error when users
771769
// try to build their apps.
772-
const SentryWebpackPlugin = loadModule('@sentry/webpack-plugin');
773-
774-
// @ts-expect-error - this exists, the dynamic import just doesn't know it
775770
if (!SentryWebpackPlugin.cliBinaryExists()) {
776771
// eslint-disable-next-line no-console
777772
console.error(

0 commit comments

Comments
 (0)