Skip to content

Commit 8828c11

Browse files
author
Luca Forstner
committed
fix tests?
1 parent 5cb675d commit 8828c11

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/nextjs/src/client/clientNormalizationIntegration.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import { WINDOW, rewriteFramesIntegration } from '@sentry/browser';
22
import { defineIntegration } from '@sentry/core';
33

4-
const windowOrigin = WINDOW.location.origin;
5-
64
export const nextjsClientStackFrameNormalizationIntegration = defineIntegration(
75
({ assetPrefix, basePath }: { assetPrefix?: string; basePath?: string }) => {
6+
const windowOrigin = WINDOW.location.origin;
7+
88
const rewriteFramesInstance = rewriteFramesIntegration({
99
// Turn `<origin>/<path>/_next/static/...` into `app:///_next/static/...`
1010
iteratee: frame => {
1111
if (assetPrefix) {
12-
frame.filename = frame.filename?.replace(assetPrefix, 'app://');
12+
if (frame.filename?.startsWith(assetPrefix)) {
13+
frame.filename = frame.filename.replace(assetPrefix, 'app://');
14+
}
1315
} else if (basePath) {
1416
try {
1517
const { origin: frameOrigin } = new URL(frame.filename as string);

0 commit comments

Comments
 (0)