Skip to content

Commit e281d54

Browse files
committed
feat: avoid wrapping middleware files when in standalone mode
1 parent 8267561 commit e281d54

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/nextjs/src/config/webpack.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ export function constructWebpackConfigFunction({
276276
});
277277

278278
// Wrap middleware
279-
if (userSentryOptions.autoInstrumentMiddleware ?? true) {
279+
const canWrapStandaloneMiddleware = userNextConfig.output !== 'standalone' || (major && major < 16);
280+
if ((userSentryOptions.autoInstrumentMiddleware ?? true) && canWrapStandaloneMiddleware) {
280281
newConfig.module.rules.unshift({
281282
test: isMiddlewareResource,
282283
use: [

0 commit comments

Comments
 (0)