This repository demonstrates a webpack cache warning that occurs when using Next.js middleware with Sentry configuration.
When running npm run build with both Next.js middleware and Sentry HOC configured, the following warning appears:
<w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (253kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)
-
Install dependencies
npm install
-
Run the build
npm run build
-
Observe the warning in console output
⚠️ WITH middleware.ts + Sentry HOC → Warning appears- ✅ WITHOUT middleware.ts + Sentry HOC → No warning
- ✅ WITH middleware.ts + WITHOUT Sentry HOC → No warning
- The warning is triggered by the combination of Next.js middleware and Sentry's
withSentryConfigHOC - The content/logic within the middleware doesn't matter - even an empty middleware function triggers it
- Removing either the middleware file or the Sentry HOC eliminates the warning
- The warning suggests that large strings (253kiB) are being serialized, impacting webpack cache performance
- Next.js: 15.3.3
- @sentry/nextjs: 9.32.0
- Node.js: Latest LTS
- TypeScript: 5.7.2
The build should complete without webpack cache warnings when using standard Next.js middleware with Sentry instrumentation.