File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
packages/react-scripts/config Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ var nodePaths = (process.env.NODE_PATH || '')
44
44
var envPublicUrl = process . env . PUBLIC_URL ;
45
45
46
46
function getPublicUrl ( appPackageJson ) {
47
- return envPublicUrl ? envPublicUrl : require ( appPackageJson ) . homepage ;
47
+ return envPublicUrl || require ( appPackageJson ) . homepage ;
48
48
}
49
49
50
50
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
@@ -54,9 +54,13 @@ function getPublicUrl(appPackageJson) {
54
54
// We can't use a relative path in HTML because we don't want to load something
55
55
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
56
56
function getServedPath ( appPackageJson ) {
57
- var homepagePath = getPublicUrl ( appPackageJson ) ;
58
- var homepagePathname = homepagePath ? url . parse ( homepagePath ) . pathname : '/' ;
59
- return envPublicUrl ? homepagePath : homepagePathname ;
57
+ var publicUrl = getPublicUrl ( appPackageJson )
58
+ if ( ! publicUrl ) {
59
+ return '/'
60
+ } else if ( envPublicUrl ) {
61
+ return publicUrl ;
62
+ }
63
+ return url . parse ( publicUrl ) . pathname ;
60
64
}
61
65
62
66
// config after eject: we're in ./config/
You can’t perform that action at this time.
0 commit comments