shadowwalker / next-pwa

Zero config PWA plugin for Next.js, with workbox 🧰
MIT License
3.75k stars 311 forks source link

Upgrading to 5.6.0 breaks Next.js Rewrites #395

Open krtkeyan opened 1 year ago

krtkeyan commented 1 year ago

Summary

Upgraded to the latest version of 5.6.0 and ended up with Next.js Rewrites throwing 404 error

Versions

Using following config,

withPWA({ 
        pwa: { 
            dest: 'public', 
            disable: process.env.NODE_ENV === 'development',
            publicExcludes: ['!assets/digest-email/*']
        },
        async rewrites() {
            return [
              {
                source: "/mp/lib.min.js",
                destination: "https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js",
              },
              {
                source: "/mp/lib.js",
                destination: "https://cdn.mxpnl.com/libs/mixpanel-2-latest.js",
              },
              {
                source: "/mp/decide",
                destination: "https://decide.mixpanel.com/decide",
              },
              {
                source: "/mp/:slug",
                destination: "https://api.mixpanel.com/:slug",
              },
            ];
          },
    })
Lekipising commented 1 year ago

Upgrade next js to version 12.2.5 then try to write your config in the way mentioned HERE