File tree 2 files changed +11
-6
lines changed
react-scripts/template/src
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,14 @@ class ModuleScopePlugin {
37
37
// Maybe an indexOf === 0 would be better?
38
38
const relative = path . relative ( appSrc , request . context . issuer ) ;
39
39
// If it's not in src/ or a subdirectory, not our request!
40
- if (
41
- relative . startsWith ( '../' ) ||
42
- relative . startsWith ( '..\\' )
43
- ) {
40
+ if ( relative . startsWith ( '../' ) || relative . startsWith ( '..\\' ) ) {
41
+ return callback ( ) ;
42
+ }
43
+ const descriptionFileRelativeToRoot = path . relative (
44
+ request . descriptionFileRoot ,
45
+ request . descriptionFilePath
46
+ ) ;
47
+ if ( descriptionFileRelativeToRoot === 'package.json' ) {
44
48
return callback ( ) ;
45
49
}
46
50
// Find path from src to the requested file
@@ -53,8 +57,7 @@ class ModuleScopePlugin {
53
57
) ;
54
58
// Error if in a parent directory of src/
55
59
if (
56
- requestRelative . startsWith ( '../' ) ||
57
- requestRelative . startsWith ( '..\\' )
60
+ requestRelative . startsWith ( '../' ) || requestRelative . startsWith ( '..\\' )
58
61
) {
59
62
callback (
60
63
new Error (
Original file line number Diff line number Diff line change 1
1
import React , { Component } from 'react' ;
2
2
import logo from './logo.svg' ;
3
3
import './App.css' ;
4
+ import { version , name } from '../../package.json' ;
4
5
5
6
class App extends Component {
6
7
render ( ) {
@@ -9,6 +10,7 @@ class App extends Component {
9
10
< div className = "App-header" >
10
11
< img src = { logo } className = "App-logo" alt = "logo" />
11
12
< h2 > Welcome to React</ h2 >
13
+ < p > { `${ name } v${ version } ` } </ p >
12
14
</ div >
13
15
< p className = "App-intro" >
14
16
To get started, edit < code > src/App.js</ code > and save to reload.
You can’t perform that action at this time.
0 commit comments