From 4ae7317000e2dfc2c2eb059e526a5e4679c8d952 Mon Sep 17 00:00:00 2001 From: Ryan Sullivan Date: Wed, 24 May 2017 03:48:35 -0700 Subject: [PATCH 1/2] Add navigateFallbackWhitelist /__* to SW Precache config --- packages/react-scripts/config/webpack.config.prod.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 3de2775e030..ecd7eb76d62 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -320,6 +320,7 @@ module.exports = { }, minify: true, navigateFallback: publicUrl + '/index.html', + navigateFallbackWhitelist: [/^(?!\/__).*/], staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/], // Work around Windows path issue in SWPrecacheWebpackPlugin: // https://github.com/facebookincubator/create-react-app/issues/2235 From d37a857e3b2cddb2150bf8bdd5dc4572ff5926df Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Wed, 24 May 2017 13:07:29 +0100 Subject: [PATCH 2/2] Add comments --- packages/react-scripts/config/webpack.config.prod.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index ecd7eb76d62..446fd5ca39d 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -319,8 +319,12 @@ module.exports = { console.log(message); }, minify: true, + // For unknown URLs, fallback to the index page navigateFallback: publicUrl + '/index.html', + // Ignores URLs starting from /__ (useful for Firebase): + // https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219 navigateFallbackWhitelist: [/^(?!\/__).*/], + // Don't precache sourcemaps (they're large) and build asset manifest: staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/], // Work around Windows path issue in SWPrecacheWebpackPlugin: // https://github.com/facebookincubator/create-react-app/issues/2235