Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/nextjs/src/config/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,11 @@ export function constructWebpackConfigFunction(
newConfig.entry = async () => addSentryToClientEntryProperty(origEntryProperty, buildContext);
}

// We don't want to do any webpack plugin stuff OR any source maps stuff in dev mode.
const isStaticExport = userNextConfig?.output === 'export';

// We don't want to do any webpack plugin stuff OR any source maps stuff in dev mode or for the server on static-only builds.
// Symbolication for dev-mode errors is done elsewhere.
if (!isDev) {
if (!isDev || !(isStaticExport && isServer)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!isDev || !(isStaticExport && isServer)) {
if (!isDev && !(isStaticExport && isServer)) {

Only handle webpack when we're in prod AND we don't have a output: 'export' build

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to !(isDev || (isStaticExport && isServer)) as it's easier to wrap the head around it (it contains two sides connected with OR and then everything is negated).

However, it's the same logical expression as !isDev && !(isStaticExport && isServer).

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { sentryWebpackPlugin } = loadModule<{ sentryWebpackPlugin: any }>('@sentry/webpack-plugin', module) ?? {};

Expand Down
Loading