Releases: DuCanhGH/next-pwa
@ducanh2912/[email protected]
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.
-
@ducanh2912/[email protected]
Patch Changes
-
ecc1fe7: fix(core): fixed user's webpack config being overridden if the plugin is disabled
- Before this patch, the plugin used to override user-defined or other plugins' Webpack custom config because it early returned the config (without calling
nextConfig.webpack?.()
) if it was disabled. This fixes it by callingnextConfig.webpack?.()
before doing anything else.
chore(types): changed
compilerOptions.moduleResolution
to"nodeNext"
.- This shouldn't impact users. It is only meant to force me to write
.js
at the end of import paths and stuff.
docs(README): refined main README.md
- Rewrote README.md to fix grammar issues and decouple tips into TIPS.md. I also fixed/removed some broken links.
chore(deps): ran deps:update-all
- Nothing too special...
- Before this patch, the plugin used to override user-defined or other plugins' Webpack custom config because it early returned the config (without calling
@ducanh2912/[email protected]
Patch Changes
-
1bcc70c:
docs(types.ts): fixed links, added example forPluginOptions.register
,PluginOptions.buildExcludes
.- This patch add an example of registering the SW on your own with
register: false
and an example of howbuildExcludes
should look like. - It also removed an invalid link (which led to Github's 404 page) and an old link (which led to a deprecated example).
chore(deps): ran deps:update-all.
- To clarify the previous patch's message, this is meant to be done at least once a month, but it can be done anytime.
style(code): cleaned up index.ts.
- Replaced
_fallbacks
withhasFallbacks
as copyingpluginOptions.fallbacks
just to indicate that the user did use this feature wasn't really necessary, and can be simplified to using a boolean.
- This patch add an example of registering the SW on your own with
@ducanh2912/[email protected]
Patch Changes
-
fix(deps): moved swc-loader to
devDependencies
andpeerDependencies
, added note that reminds users to install swc-loader when using fallbacks and custom worker inPluginOptions
.- swc-loader being in
dependencies
didn't do anything as webpack wants it declared in the user'spackage.json
, so I moved it todevDependencies
and added it topeerDependencies
(optional).
docs(README): fixed example
create-next-app
command (added --example flag).- Before this change it wasn't a really valid command; while
create-next-app
does run, it will crash on trying to create ahttps://github.com/DuCanhGH/next-pwa/tree/master/examples/basic
folder.
chore(lockfile): moved to pnpm-lock.yaml's v6 format.
- This doesn't change anything, I just think it is nice to migrate as it will become the default anyway.
- swc-loader being in
@ducanh2912/[email protected]
Minor Changes
-
f224625:
feat(core): added support for/_offline.tsx
page in appDir.- With this version,
app/_offline/page.tsx
will automatically enable the fallback worker just like pages/_offline.tsx.
chore(deps): updated all dependencies
- This version also bumps every dependency to their latest versions. This process is done monthly.
- With this version,
@ducanh2912/[email protected]
Minor Changes
-
refactor(core): replaced babel with swc.
-
This version replaces babel-loader with swc-loader when building fallback workers and custom workers so that we don't have to use the old
next/babel
anymore. -
There should be no changes needed except for deleting babel-loader and @babel/core from your
devDependencies
if you don't need them anymore, because this package doesn't.
refactor(examples): converted every example to Typescript, renamed some, deprecated some.
-
@ducanh2912/[email protected]
Patch Changes
- 360c94a: Fix @ducanh2912/next-pwa not having a README.md on npm