【发布时间】:2018-12-22 18:30:21
【问题描述】:
如何使用 google workbox (workbox-webpack-plugin) 从 service worker 缓存中删除 index.html? 之前用的是我刚写的sw-precache-plugin
new SWPrecacheWebpackPlugin({
dontCacheBustUrlsMatching: /\.\w{8}\./,
filename: 'service-worker.js',
minify: true,
navigateFallback: '/index.html',
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/, /index\.html$/],
})
但它不起作用
new GenerateSW({
cacheId: 'my-app-name',
importWorkboxFrom: 'local',
skipWaiting: true,
clientsClaim: true,
navigateFallback: '/index.html',
exclude: [/\.map$/, /^manifest.*\.js(?:on)?$/, /\.html$/],
}),
manifest 文件中不存在 Html 文件,但每次都从 service worker 中获取。
【问题讨论】:
标签: webpack workbox workbox-webpack-plugin