Repository navigation
fix(browser): Fix parenthesis parsing logic for chromium - #12373
Conversation
c93fa86 to
1933b22
Compare
size-limit report 📦
|
|
0.2% bundle increase which busted the size limit for |
| stack: `Error: bad | ||
| at something (http://localhost:5000/(some)/(thing)/index.html:20:16) | ||
| at http://localhost:5000/(group)/[route]/script.js:1:126 | ||
| at more (http://localhost:5000/(some)/(thing)/index.html:25:7)`, |
There was a problem hiding this comment.
Is this could be passed?
at (http://localhost:5000/(group)/[route]/script.js:1:126)
There was a problem hiding this comment.
I had the same thought but chrome doesn't emit such frames I think.
There was a problem hiding this comment.
We haven't seen stack lines like that. They only appear to be surrounded in parenthesis when there is filename.
| } | ||
|
|
||
| // Chromium based browsers: Chrome, Brave, new Opera, new Edge | ||
| const chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i; |
There was a problem hiding this comment.
could we add a comment here for what this would match, as an example? makes it easier to follow this than to try to parse the regex 😅
|
nice @lforst when will it be released? |
|
soon™ |
Thanks for mention! |
Co-authored-by: Tim Fish <[email protected]>
We had a bug where the chrome stack trace parser incorrectly parsed stack frames when the frame was not inside a function (ie. top level in a module) and contained parentheses.
This surfaced in Next.js because Next.js has file based routing with folders that can contain parentheses and our debug ID injection snippet is injected top-level.
We fix this by first using a regex that attempts to match a simple top level module frame, and if it matches we extract the filename and line/colnumbers without attempting to use the more elaborate regex.