vue.jsnuxt.jsshared-worker

It has a way to use shared-workers with NuxtJS v.2.14.12?


I've a NuxtJS application and I'm trying to share a websocket connection throught the open tabs. Researching for this, I have found a way using shared-workers but I dont found this at Nuxt / Nuxt PWA documentation. I only found way to create custom workers in Nuxt PWA module with workbox.


Solution

  • I've been solved this problem using a Worker-Loader in my project. With this, I can configure worker files, incluse type of worker (sharedworker in this case) and import like a javascript module inside my component file.

    This helps me how to configure: Using webpack worker-loader with nuxt.js