Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ServiceWorker with ES6 module imports (Google Chrome)

Is it possible to use ES6 module imports in serviceworkers in latest Google Chrome?

I found this closed thread on w3c specs but it's not clear to me how to make it work on Google Chrome.

Tryied this but with no luck:

navigator.serviceWorker.register('/sw.mjs', {type:'module'})
like image 244
Fabiano Taioli Avatar asked Nov 18 '18 11:11

Fabiano Taioli


1 Answers

According to this article "JS module support for shared workers and service workers is coming soon ..." https://developers.google.com/web/fundamentals/primers/modules

Also, its tracked in this issue: https://bugs.chromium.org/p/chromium/issues/detail?id=680046

like image 53
Sam Avatar answered Oct 15 '22 21:10

Sam