next-pwa icon indicating copy to clipboard operation
next-pwa copied to clipboard

Nextjs v13: How to bundle an external library to use it in a service worker?

Open ninsky opened this issue 2 years ago • 1 comments

Hi

I'm using next-pwa to create a progressive web app. Till today I didn't find out how to bundle an external library (https://github.com/jakearchibald/idb) to use the library in a service worker. Instead I had to duplicate my code from the /src to the scope of the service worker which is the /public folder in my case.

Now with Nextjs13 there seems to be an easier way to bundle external packages. Does anyone have an example how to bundle an external library like "idb" and import it in a service worker and in the "/src" folder?

Thanks in advance Nino

ninsky avatar Jan 16 '23 09:01 ninsky

@ninsky did you ever find the solution? Facing the same problem now!

marharyta avatar Nov 19 '23 11:11 marharyta