我的构建会生成一个如下所示的预缓存清单:
self.__precacheManifest = [
{
"revision": "ea92339a72de73748c35",
"url": "/js/vendor.ea92339a.js"
},
{
"revision": "ce28c628eea246b643c9",
"url": "/js/manifest.ce28c628.js"
},
{
"revision": "f6fb0d3455c4d454bfc9",
"url": "/js/app.f6fb0d34.js"
},
{
"revision": "dc4521ffd102851e081b02ac893f4981",
"url": "/index.html"
},
{
"revision": "f6fb0d3455c4d454bfc9",
"url": "/css/app.69e433b0.css"
}
];
在我的服务人员中,我在顶部有这个:
importScripts("/precache-manifest.14324d3ff39abcb589e6152671cf34d2.js", "https://storage.googleapis.com/workbox-cdn/releases/3.0.1/workbox-sw.js");
这在底部:
self.__precacheManifest = [].concat(self.__precacheManifest || [])
workbox.precaching.precacheAndRoute(self.__precacheManifest, {})
这可行,但是现在我想从服务人员调用内部的方法,/js/vendor.ea92339a.js
我该如何完成呢?
额外信息:我使用的构建过程是 vue-cli 3,webpack 4 分支(仍处于测试阶段)