File tree 2 files changed +11
-2
lines changed
packages/gatsby/cache-dir/fast-refresh-overlay
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ export function BuildError({ error }) {
14
14
const decoded = prettifyStack ( error )
15
15
const [ filePath ] = decoded
16
16
const file = filePath . content . split ( `\n` ) [ 0 ]
17
+ const lineMatch = filePath . content . match ( / \( ( \d + ) [ ^ ) ] + \) / )
18
+ let line = 1
19
+
20
+ if ( lineMatch ) {
21
+ line = lineMatch [ 1 ]
22
+ }
17
23
18
24
return (
19
25
< Overlay >
@@ -22,7 +28,10 @@ export function BuildError({ error }) {
22
28
< h1 id = "gatsby-overlay-labelledby" > Failed to compile</ h1 >
23
29
< span > { file } </ span >
24
30
</ div >
25
- < HeaderOpenClose open = { ( ) => openInEditor ( file , 1 ) } dismiss = { false } />
31
+ < HeaderOpenClose
32
+ open = { ( ) => openInEditor ( file , line ) }
33
+ dismiss = { false }
34
+ />
26
35
</ Header >
27
36
< Body >
28
37
< h2 > Source</ h2 >
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export function prettifyStack(errorInformation) {
23
23
}
24
24
25
25
export function openInEditor ( file , lineNumber = 1 ) {
26
- window . fetch (
26
+ fetch (
27
27
`/__open-stack-frame-in-editor?fileName=` +
28
28
window . encodeURIComponent ( file ) +
29
29
`&lineNumber=` +
You can’t perform that action at this time.
0 commit comments