From 880596d8a3b31c301d849cc6612c9730af2399c8 Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Thu, 4 Nov 2021 20:20:40 -0700 Subject: [PATCH] don't do rewriteFrames hack in dev --- packages/nextjs/src/config/webpack.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index 21ffc5e3381a..98bd56b66a57 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -138,8 +138,10 @@ async function addSentryToEntryProperty( const filesToInject = [`./${userConfigFile}`]; // Support non-default output directories by making the output path (easy to get here at build-time) available to the - // server SDK's default `RewriteFrames` instance (which needs it at runtime). - if (buildContext.isServer) { + // server SDK's default `RewriteFrames` instance (which needs it at runtime). Doesn't work when using the dev server + // because it somehow tricks the file watcher into thinking that compilation itself is a file change, triggering an + // infinite recompiling loop. (This should be fine because we don't upload sourcemaps in dev in any case.) + if (buildContext.isServer && !buildContext.dev) { const rewriteFramesHelper = path.resolve( fs.mkdtempSync(path.resolve(os.tmpdir(), 'sentry-')), 'rewriteFramesHelper.js',