在 ServiceWorker
范围内使用 RequireJS 导入外部库的正确方法是什么?
在 WebWorkers 范围内我们可以使用 importScripts()
RequireJS in web worker .
如何在 我们可以离线 的 ServiceWorker 范围内解决?
我认为 ImportScript()
会失败,然后需要将库搜索到 Serviceworker
缓存中,有什么建议吗?
非常感谢。
PD:我尝试创建标签“service-worker”,但我没有足够的声誉;((我改用 web-worker)。
最佳答案
我在 ServiceWorker / explainer.md 找到了答案
The scripts that have been imported the first time the worker is run will be cached along side it by the browser. The upside is that imported scripts will be downloaded and cached alongside the main ServiceWorker script.
关于ServiceWorker 中的 RequireJS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25831705/