Yovach / next-public-ts

A webpack plugin to compile TypeScript and JavaScript files into the public folder of a Next.js project
6 stars 0 forks source link

The compiled code includes `export {}` on service worker #39

Closed Yovach closed 10 months ago

Yovach commented 10 months ago

If you have an error on serviceWorker.register call, add the {type: module} like this:

navigator.serviceWorker.register('/sw.js', { type: "module" }).then((value) => {
  setIsInstalled(true);
})