Skip to content

Commit cf24dd4

Browse files
authored
fix: Tracekit regex to support ram bundles (#2047)
* fix: Tracekit regex to support ram bundles * fix: TraceKit Regex * meta: Changelog
1 parent ab7ba81 commit cf24dd4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- [browser] ref: Mangle more stuff, reduce bundle size
6+
- [browser] fix: Support for ram bundle frames
67
- [node] fix: Expose lastEventId method
78

89
## 5.1.1

packages/browser/src/tracekit.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,10 @@ TraceKit._computeStackTrace = (function _computeStackTraceWrapper() {
474474
}
475475

476476
var chrome = /^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,
477-
gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,
477+
// gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
478+
// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
479+
// We need this specific case for now because we want no other regex to match.
480+
gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i,
478481
winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
479482
// Used to additionally parse URL/line/column from eval frames
480483
isEval,

0 commit comments

Comments
 (0)