Skip to content

Commit dffbccf

Browse files
committed
Fix tmp path of rewriteFramesHelper
1 parent 0d07854 commit dffbccf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/nextjs/src/config/webpack.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ async function addSentryToEntryProperty(
137137
// because it somehow tricks the file watcher into thinking that compilation itself is a file change, triggering an
138138
// infinite recompiling loop. (This should be fine because we don't upload sourcemaps in dev in any case.)
139139
if (isServer && !isDev) {
140-
const rewriteFramesHelper = path.resolve(
141-
fs.mkdtempSync(path.resolve(os.tmpdir(), 'sentry-')),
142-
'rewriteFramesHelper.js',
143-
);
140+
const rewriteFramesHelper = path.resolve(os.tmpdir(), 'sentry-javascript', 'rewriteFramesHelper.js');
141+
if (!fs.existsSync(path.dirname(rewriteFramesHelper))) {
142+
fs.mkdirSync(path.dirname(rewriteFramesHelper));
143+
}
144144
fs.writeFileSync(rewriteFramesHelper, `global.__rewriteFramesDistDir__ = '${userNextConfig.distDir}';\n`);
145145
// stick our helper file ahead of the user's config file so the value is in the global namespace *before*
146146
// `Sentry.init()` is called

0 commit comments

Comments
 (0)