NOTE: despite this being a major update, you shouldn't have too many troubles migrating from v7 to v8.
Major Changes
-
73a4f26: BREAKING CHANGE (typescript): renamed Fallbacks to FallbackRoutes, /register to /workbox.
-
Some JSDoc has also been added to FallbackRoutes.
-
Changing /register to /workbox should have minimal impact, you only need to change
"@ducanh2912/next-pwa/register"
incompilerOptions.types
to"@ducanh2912/next-pwa/worker"
.
BREAKING CHANGE (PluginOptions): removed
PluginOptions.exclude
.- You should use
PluginOptions.buildExcludes
instead. It is almost the same asPluginOptions.exclude
, except for the fact that it doesn't override the plugin'sexclude
function, which is used to exclude files that shouldn't/can't be precached.
style(code): renamed
register.ts
tosw-entry.ts
.- I think this name conveys the meaning of the file better, as it doesn't only register the SW but also handles some of the plugin's features.
NOTE: How to upgrade:
-
Change
"@ducanh2912/next-pwa/register"
in yourtsconfig.json
'scompilerOptions.types
to"@ducanh2912/next-pwa/worker"
. -
Change
exclude
tobuildExcludes
like so:
import withPWAInit from "@ducanh2912/next-pwa"; const withPWA = withPWAInit({ // your other options, workboxOptions: { exclude: [], }, }); export default withPWA({ // your Next config });
to
import withPWAInit from "@ducanh2912/next-pwa"; const withPWA = withPWAInit({ // your other options, buildExcludes: [], }); export default withPWA({ // your Next config });
- If you have used the interface
Fallbacks
somewhere in your code, just change it toFallbackRoutes
.
-
Minor Changes
-
0646231: feat(core): support for path aliases in custom worker
- This does it by copying Next.js's
webpackConfig.resolve
into custom worker's Webpack config.
- This does it by copying Next.js's
Patch Changes
-
4172cd0: chore(deps, code): updated all deps, cleaned up some code, removed subdomainPrefix.
-
This will remove subdomainPrefix from types.ts, but it will only trigger TS if you still have that option, because it stopped doing anything ages ago.
-
Cleaned up some code while I was finding a way to better support offline.
-