hanford / next-offline

make your Next.js application work offline using service workers via Google's workbox
https://github.com/hanford/next-offline
1.59k stars 111 forks source link

Service workers are not generated #305

Open w8ze-devel opened 1 year ago

w8ze-devel commented 1 year ago

Hello,

I've made the minimal configuration but yet no service-workers are generated.

Just have this next.config.js and build my nextJs application

//@ts-check
const { composePlugins, withNx } = require('@nx/next');

/**
 * @type {import('@nx/next/plugins/with-nx').WithNxOptions}
 **/
const nextConfig = {
  nx: {
    svgr: true,
  },
  workboxOpts: {
    swDest: 'public/service-worker.js',
    runtimeCaching: [{
      urlPattern: /^http?.*/,
      handler: 'StaleWhileRevalidate',
      options: {
        cacheName: 'joimport-assets-cache',
        expiration: {
          maxEntries: 20,
          maxAgeSeconds: 600,
        },
      },
    }],
  }
};

const plugins = [
  // Add more Next.js plugins to this list if needed.
  require('next-offline'),
  withNx,
];

module.exports = composePlugins(...plugins)(nextConfig);

And here is the output

image

I can see my custom service workers but nothing more.

image

Service worker generated and loaded

Tried Edge and Chrome (latest version)

Please, any help would be appreciate.

Thanks