Skip to content

Commit

Permalink
Revert "fix(nextjs): Avoid importing SentryWebpackPlugin in dev mode (
Browse files Browse the repository at this point in the history
#8557)"

This reverts commit 0ca7389.
  • Loading branch information
Lms24 committed Jul 31, 2023
1 parent 878d1e4 commit 7fd2d85
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions packages/nextjs/src/config/webpack.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-disable complexity */
/* eslint-disable max-lines */
import { getSentryRelease } from '@sentry/node';
import { arrayify, dropUndefinedKeys, escapeStringForRegex, loadModule, logger } from '@sentry/utils';
import { arrayify, dropUndefinedKeys, escapeStringForRegex, logger } from '@sentry/utils';
import { default as SentryWebpackPlugin } from '@sentry/webpack-plugin';
import * as chalk from 'chalk';
import * as fs from 'fs';
import * as path from 'path';
Expand Down Expand Up @@ -312,11 +313,8 @@ export function constructWebpackConfigFunction(
// without, the option to use `hidden-source-map` only applies to the client-side build.
newConfig.devtool = userSentryOptions.hideSourceMaps && !isServer ? 'hidden-source-map' : 'source-map';

const SentryWebpackPlugin = loadModule('@sentry/webpack-plugin');

newConfig.plugins = newConfig.plugins || [];
newConfig.plugins.push(
// @ts-expect-error - this exists, the dynamic import just doesn't know about it
new SentryWebpackPlugin(
getWebpackPluginOptions(buildContext, userSentryWebpackPluginOptions, userSentryOptions),
),
Expand Down Expand Up @@ -769,9 +767,6 @@ function shouldEnableWebpackPlugin(buildContext: BuildContext, userSentryOptions
// architecture-specific version of the `sentry-cli` binary. If `yarn install`, `npm install`, or `npm ci` are run
// with the `--ignore-scripts` option, this will be blocked and the missing binary will cause an error when users
// try to build their apps.
const SentryWebpackPlugin = loadModule('@sentry/webpack-plugin');

// @ts-expect-error - this exists, the dynamic import just doesn't know it
if (!SentryWebpackPlugin.cliBinaryExists()) {
// eslint-disable-next-line no-console
console.error(
Expand Down

0 comments on commit 7fd2d85

Please sign in to comment.