From 02f53e81caea999ddba45f2cd012a9fb976c839e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rami=20Ker=C3=A4nen?= Date: Tue, 19 Sep 2017 06:49:24 +0100 Subject: [PATCH 1/3] Change template manifest start_url to dot to make it react-router friendly --- packages/react-scripts/template/public/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/template/public/manifest.json b/packages/react-scripts/template/public/manifest.json index be607e41771..2a0afddf98f 100644 --- a/packages/react-scripts/template/public/manifest.json +++ b/packages/react-scripts/template/public/manifest.json @@ -8,7 +8,7 @@ "type": "image/png" } ], - "start_url": "./index.html", + "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" From 4794189e0a07a3e52388b4cb7bbbcf62d38edb5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rami=20Ker=C3=A4nen?= Date: Tue, 19 Sep 2017 18:57:14 +0100 Subject: [PATCH 2/3] Revert "Change template manifest start_url to dot to make it react-router friendly" This reverts commit 02f53e81caea999ddba45f2cd012a9fb976c839e. --- packages/react-scripts/template/public/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/template/public/manifest.json b/packages/react-scripts/template/public/manifest.json index 2a0afddf98f..be607e41771 100644 --- a/packages/react-scripts/template/public/manifest.json +++ b/packages/react-scripts/template/public/manifest.json @@ -8,7 +8,7 @@ "type": "image/png" } ], - "start_url": ".", + "start_url": "./index.html", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" From 368fc79128599f90f22b8472739b6824025b87b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rami=20Ker=C3=A4nen?= Date: Tue, 19 Sep 2017 18:58:11 +0100 Subject: [PATCH 3/3] Add a note about PWA manifest and client-side routing --- packages/react-scripts/template/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index c55ccdf949f..b233ad105a0 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -1784,6 +1784,12 @@ service worker navigation routing can be configured or disabled by and [`navigateFallbackWhitelist`](https://github.com/GoogleChrome/sw-precache#navigatefallbackwhitelist-arrayregexp) options of the `SWPreachePlugin` [configuration](../config/webpack.config.prod.js). +When users install your app to the homescreen of their device the default configuration will make a shortcut to `/index.html`. This may not work for client-side routers which expect the app to be served from `/`. Edit the web app manifest at [`public/manifest.json`](public/manifest.json) and change `start_url` to match the required URL scheme, for example: + +```js + "start_url": ".", +``` + ### Building for Relative Paths By default, Create React App produces a build assuming your app is hosted at the server root.