Skip to content

Commit 1b3dfd0

Browse files
author
farfromrefuge
committed
fix: rewrite frame fix for latest sdk
1 parent 4836cc4 commit 1b3dfd0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/sdk.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,18 @@ export function init(passedOptions: NativescriptOptions): void {
117117
rewriteFrameIntegration = new RewriteFrames({
118118
iteratee: (frame: StackFrame) => {
119119
if (frame.platform === 'javascript' && frame.filename) {
120-
let filename = (frame.filename = frame.filename
120+
let filename = frame.filename
121121
.replace(/^file\:\/\//, '')
122+
.replace(/^app\:\/\//, '')
122123
.replace(/^address at /, '')
123-
.replace(/^.*\/[^\.]+(\.app|CodePush|.*(?=\/))/, ''));
124+
.replace(/^.*\/[^\.]+(\.app|CodePush|.*(?=\/))/, '');
124125

125-
// const appPrefix = 'app://';
126126
if (frame.filename.indexOf('[native code]') === -1) {
127-
const appPrefix = options.appPrefix || 'app:///';
127+
const appPrefix = options.appPrefix ?? '~/';
128128
if (appPrefix.endsWith('//') && !appPrefix.endsWith('///')) {
129-
filename = frame.filename.indexOf('/') === 0 ? `${appPrefix}${frame.filename}` : `${appPrefix}/${frame.filename}`;
129+
filename = filename.indexOf('/') === 0 ? `${appPrefix}${filename}` : `${appPrefix}/${filename}`;
130130
} else {
131-
filename = frame.filename.indexOf('/') === 0 ? `${appPrefix}${frame.filename.slice(1)}` : `${appPrefix}${frame.filename}`;
131+
filename = filename.indexOf('/') === 0 ? `${appPrefix}${filename.slice(1)}` : `${appPrefix}${filename}`;
132132
}
133133
}
134134

0 commit comments

Comments
 (0)