Skip to content

@ducanh2912/[email protected]

Compare
Choose a tag to compare
@DuCanhGH DuCanhGH released this 05 Feb 13:05
· 228 commits to master since this release
c840228

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" in compilerOptions.types to "@ducanh2912/next-pwa/worker".

    BREAKING CHANGE (PluginOptions): removed PluginOptions.exclude.

    • You should use PluginOptions.buildExcludes instead. It is almost the same as PluginOptions.exclude, except for the fact that it doesn't override the plugin's exclude function, which is used to exclude files that shouldn't/can't be precached.

    style(code): renamed register.ts to sw-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 your tsconfig.json's compilerOptions.types to "@ducanh2912/next-pwa/worker".

    • Change exclude to buildExcludes 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 to FallbackRoutes.

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.

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.