mirror of
https://github.com/withastro/astro.git
synced 2025-01-13 22:11:20 -05:00
fix(cli): call path.replace only if it is a function (#10745)
* fix(cli): call `path.replace` only if it is a function * add changeset
This commit is contained in:
parent
f1bc3dea92
commit
d51951ce62
2 changed files with 6 additions and 1 deletions
5
.changeset/late-spoons-knock.md
Normal file
5
.changeset/late-spoons-knock.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"astro": patch
|
||||
---
|
||||
|
||||
Fixes an issue where CLI commands could not report the reason for failure before exiting.
|
|
@ -174,7 +174,7 @@ function collectInfoFromStacktrace(error: SSRError & { stack: string }): StackIn
|
|||
stackText.split('\n').find((ln) => ln.includes('src') || ln.includes('node_modules'));
|
||||
// Disable eslint as we're not sure how to improve this regex yet
|
||||
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
||||
const source = possibleFilePath?.replace(/^[^(]+\(([^)]+).*$/, '$1').replace(/^\s+at\s+/, '');
|
||||
const source = possibleFilePath?.replace?.(/^[^(]+\(([^)]+).*$/, '$1').replace(/^\s+at\s+/, '');
|
||||
|
||||
let file = source?.replace(/:\d+/g, '');
|
||||
const location = /:(\d+):(\d+)/.exec(source!) ?? [];
|
||||
|
|
Loading…
Add table
Reference in a new issue