File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
react-error-overlay/src/components
react-scripts/template/src Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -127,13 +127,12 @@ function createFrame(
127
127
lastElement : boolean
128
128
) {
129
129
const { compiled } = frameSetting ;
130
- let { functionName } = frame ;
130
+ let { functionName, _originalFileName : sourceFileName } = frame ;
131
131
const {
132
132
fileName,
133
133
lineNumber,
134
134
columnNumber,
135
135
_scriptCode : scriptLines ,
136
- _originalFileName : sourceFileName ,
137
136
_originalLineNumber : sourceLineNumber ,
138
137
_originalColumnNumber : sourceColumnNumber ,
139
138
_originalScriptCode : sourceLines ,
@@ -149,6 +148,10 @@ function createFrame(
149
148
150
149
let url ;
151
150
if ( ! compiled && sourceFileName && sourceLineNumber ) {
151
+ // Remove everything up to the first /src/
152
+ const trimMatch = / .* ?[ / | \\ ] ( s r c [ / | \\ ] .* ) / . exec ( sourceFileName ) ;
153
+ if ( trimMatch && trimMatch [ 1 ] ) sourceFileName = trimMatch [ 1 ] ;
154
+
152
155
url = sourceFileName + ':' + sourceLineNumber ;
153
156
if ( sourceColumnNumber ) {
154
157
url += ':' + sourceColumnNumber ;
Original file line number Diff line number Diff line change @@ -2,13 +2,28 @@ import React, { Component } from 'react';
2
2
import logo from './logo.svg' ;
3
3
import './App.css' ;
4
4
5
+ import Bad from './fold/Bad' ;
6
+
5
7
class App extends Component {
6
8
render ( ) {
7
9
return (
8
10
< div className = "App" >
9
11
< div className = "App-header" >
10
- < img src = { logo } className = "App-logo" alt = "logo" />
11
- < h2 > Welcome to React</ h2 >
12
+ < div >
13
+ < div >
14
+ < div >
15
+ < div >
16
+ < div >
17
+ < div >
18
+ < img src = { logo } className = "App-logo" alt = "logo" />
19
+ < Bad > Welcome to React</ Bad >
20
+ { [ 1 , 2 , 3 ] . map ( s => < span > { s } </ span > ) }
21
+ </ div > { ' ' }
22
+ </ div > { ' ' }
23
+ </ div > { ' ' }
24
+ </ div > { ' ' }
25
+ </ div > { ' ' }
26
+ </ div >
12
27
</ div >
13
28
< p className = "App-intro" >
14
29
To get started, edit < code > src/App.js</ code > and save to reload.
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+
3
+ let Lol = null ;
4
+ export default function Bad ( ) {
5
+ return < div > < h2 > < Lol /> </ h2 > </ div > ;
6
+ }
You can’t perform that action at this time.
0 commit comments