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 113 forks source link

Could not find a declaration file for module 'next-offline' #303

Open w8ze-devel opened 11 months ago

w8ze-devel commented 11 months ago

Hello,

Thanks very much for this project. I've just discovered it while searching about how to implement offline mode in my nextjs application.

Please consider the following items when filing a bug report:

Just made a yarn add next-offline and try to build my application.

Here is my complete next.config.js

//@ts-check
const withOffline = require('next-offline');

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { composePlugins, withNx } = require('@nx/next');

/**
 * @type {import('@nx/next/plugins/with-nx').WithNxOptions}
 **/
const nextConfig = {
  nx: {
    svgr: true,
  },
  workboxOpts: {
    runtimeCaching: [{
      handler: 'StaleWhileRevalidate',
      options: {
        cacheName: 'assets-cache',
        expiration: {
          maxEntries: 5,
          maxAgeSeconds: 60,
        },
      },
    }],
  }
};

const plugins = [
  withNx,
];

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

The build is done properly.

The error in the above screenshoot.

Try on Chrome and Edge (latest version)

Thanks for advance for your help.