Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 26.9k
Switch to the Workbox InjectManifest plugin#9205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
54d3740e9fa48b5a3a6c70eed4373308fb6b0cab1b53b142a8707cc7d2545aa3ee8b1fa8931298ff1fe3f96d1d2c674f01d22c7dc563589c49b27d5f8245c9f3adc7394d6494d949faab02ebb47f768c934a46dc419a883991e683File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -60,6 +60,9 @@ const imageInlineSizeLimit = parseInt( | ||
| // Check if TypeScript is setup | ||
| const useTypeScript = fs.existsSync(paths.appTsConfig); | ||
| // Get the path to the uncompiled service worker (if it exists). | ||
| const swSrc = paths.swSrc; | ||
| // style files regexes | ||
| const cssRegex = /\.css$/; | ||
| const cssModuleRegex = /\.module\.css$/; | ||
| @@ -692,20 +695,11 @@ module.exports = function (webpackEnv) { | ||
| // Generate a service worker script that will precache, and keep up to date, | ||
| // the HTML & assets that are part of the webpack build. | ||
| isEnvProduction && | ||
| new WorkboxWebpackPlugin.GenerateSW({ | ||
| clientsClaim: true, | ||
| exclude: [/\.map$/, /asset-manifest\.json$/], | ||
| importWorkboxFrom: 'cdn', | ||
| navigateFallback: paths.publicUrlOrPath + 'index.html', | ||
| navigateFallbackBlacklist: [ | ||
| // Exclude URLs starting with /_, as they're likely an API call | ||
| new RegExp('^/_'), | ||
| // Exclude any URLs whose last part seems to be a file extension | ||
| // as they're likely a resource and not a SPA route. | ||
| // URLs containing a "?" character won't be blacklisted as they're likely | ||
| // a route with query params (e.g. auth callbacks). | ||
| new RegExp('/[^/?]+\\.[^/]+$'), | ||
| ], | ||
| fs.existsSync(swSrc) && | ||
ianschmitz marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| new WorkboxWebpackPlugin.InjectManifest({ | ||
| swSrc, | ||
| dontCacheBustURLsMatching: /\.[0-9a-f]{8}\./, | ||
ianschmitz marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| exclude: [/\.map$/, /asset-manifest\.json$/, /LICENSE/], | ||
| }), | ||
| // TypeScript type checking | ||
| useTypeScript && | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -82,7 +82,7 @@ | ||
| "webpack": "4.43.0", | ||
| "webpack-dev-server": "3.11.0", | ||
| "webpack-manifest-plugin": "2.2.0", | ||
| "workbox-webpack-plugin": "4.3.1" | ||
| "workbox-webpack-plugin": "5.1.3" | ||
jeffposnick marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| }, | ||
| "devDependencies": { | ||
| "react": "^16.12.0", | ||
Uh oh!
There was an error while loading. Please reload this page.