Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Commit

Permalink
Fix Unexpected token < error
Browse files Browse the repository at this point in the history
By default skipWaiting parameter is set to true, allowing newly
registered service worker to bypass the `waiting` state, so all out of
date cache entries from the previous service worker will be deleted.

Because of async dynamic module loading we don't want that to happen,
keeping a way of loading old chunks.

The downside of removing skipWaiting is that newly deployed
service worker code and caches won't become active until all existing
tabs that have an older version of that service worker are closed, but
that actually sounds we want exactly this behaviour.

Related to
GoogleChromeLabs/sw-precache#180 (comment)
  • Loading branch information
Valerii Gusev committed Jul 28, 2018
1 parent c8fd66a commit c42365b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ module.exports = {
navigateFallbackWhitelist: [/^(?!\/__).*/],
// Don't precache sourcemaps (they're large) and build asset manifest:
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
// we are relying on older cached resources to be available throughout the page's lifetime
// because of async module loading
skipWaiting: false,
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
Expand Down

0 comments on commit c42365b

Please sign in to comment.