简体   繁体   中英

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'})

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM