Commit 8cc1ff1 1 parent 359df9a commit 8cc1ff1 Copy full SHA for 8cc1ff1
File tree 4 files changed +13
-3
lines changed
4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ if (_commander2.default.staticDir) {
95
95
process . exit ( - 1 ) ;
96
96
}
97
97
logger . log ( '=> Copying static files from: ' + dir ) ;
98
- _shelljs2 . default . cp ( '-r' , dir + '/' , outputDir ) ;
98
+ _shelljs2 . default . cp ( '-r' , dir + '/* ' , outputDir ) ;
99
99
} ) ;
100
100
}
101
101
Original file line number Diff line number Diff line change @@ -47,7 +47,12 @@ function loadEnv() {
47
47
48
48
var defaultNodeEnv = options . production ? 'production' : 'development' ;
49
49
var env = {
50
- 'process.env.NODE_ENV' : ( 0 , _stringify2 . default ) ( process . env . NODE_ENV || defaultNodeEnv )
50
+ 'process.env.NODE_ENV' : ( 0 , _stringify2 . default ) ( process . env . NODE_ENV || defaultNodeEnv ) ,
51
+ // This is to support CRA's public folder feature.
52
+ // In production we set this to dot(.) to allow the browser to access these assests
53
+ // even when deployed inside a subpath. (like in GitHub pages)
54
+ // In development this is just empty as we always serves from the root.
55
+ 'process.env.PUBLIC_URL' : ( 0 , _stringify2 . default ) ( options . production ? '.' : '' )
51
56
} ;
52
57
53
58
( 0 , _keys2 . default ) ( process . env ) . filter ( function ( name ) {
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ if (program.staticDir) {
69
69
process . exit ( - 1 ) ;
70
70
}
71
71
logger . log ( `=> Copying static files from: ${ dir } ` ) ;
72
- shelljs . cp ( '-r' , `${ dir } /` , outputDir ) ;
72
+ shelljs . cp ( '-r' , `${ dir } /* ` , outputDir ) ;
73
73
} ) ;
74
74
}
75
75
Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ export function loadEnv(options = {}) {
27
27
const defaultNodeEnv = options . production ? 'production' : 'development' ;
28
28
const env = {
29
29
'process.env.NODE_ENV' : JSON . stringify ( process . env . NODE_ENV || defaultNodeEnv ) ,
30
+ // This is to support CRA's public folder feature.
31
+ // In production we set this to dot(.) to allow the browser to access these assests
32
+ // even when deployed inside a subpath. (like in GitHub pages)
33
+ // In development this is just empty as we always serves from the root.
34
+ 'process.env.PUBLIC_URL' : JSON . stringify ( options . production ? '.' : '' ) ,
30
35
} ;
31
36
32
37
Object . keys ( process . env )
You can’t perform that action at this time.
0 commit comments