shadowwalker / next-pwa

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

Build doesn't work #214

Closed shiftrtech closed 3 years ago

shiftrtech commented 3 years ago

Summary

When i try to build my app (next build) im getting this error:

> [PWA] Compile client (static)
> [PWA] Custom worker found: /opt/build/repo/worker/index.ts
> [PWA] Build custom worker: /opt/build/repo/public/worker-GVGQNiF3aTWRHWnczwV6T.js
> [PWA] Auto register service worker with: /opt/build/repo/node_modules/next-pwa/register.js
> [PWA] Service worker: /opt/build/repo/public/sw.js
> [PWA]   url: /sw.js
> [PWA]   scope: /
> [PWA] Fallback to precache routes when fetch failed from cache or network:
> [PWA]   document (page): /_offline
> [PWA] Compile server

Creating an optimized production build ...
.\node_modules\next\dist\compiled\webpack\bundle5.js:114742
                                fn: str => str.startsWith(condition)
                                               ^

TypeError: Cannot read property 'startsWith' of null

Versions

How To Reproduce

Steps to reproduce the behavior:

  1. next build
  2. See error

Expected Behaviors

A successful compilation

Additional Context

PWA config:

module.exports = withPWA({
  future: {
    webpack5: true
  },
  poweredByHeader: false,
  pwa: {
    disable: process.env.NODE_ENV === 'development',
    dest: 'public'
  },
})
shiftrtech commented 3 years ago

This more about next than next-pwa see