简体   繁体   English

带有ES6模块导入的ServiceWorker(谷歌浏览器)

[英]ServiceWorker with ES6 module imports (Google Chrome)

Is it possible to use ES6 module imports in serviceworkers in latest Google Chrome? 是否可以在最新的Google Chrome浏览器中的服务工作人员中使用ES6模块导入?

I found this closed thread on w3c specs but it's not clear to me how to make it work on Google Chrome. 我在w3c规格上发现了这个封闭的线程 ,但是我不清楚如何使其在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 根据这篇文章“即将为共享工作者和服务工作者提供JS模块支持...” https://developers.google.com/web/fundamentals/primers/modules

Also, its tracked in this issue: https://bugs.chromium.org/p/chromium/issues/detail?id=680046 此外,它在此问题中得到跟踪: https : //bugs.chromium.org/p/chromium/issues/detail?id=680046

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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