I have a Webpack config file that uses a webpack-pwa-manifest
plugin (https://github.com/arthurbergmz/webpack-pwa-manifest) to generate a PWA manifest file. The manifest file name is manifest.hash.json
, where "hash" is a value dynamically generated on every build.
I'm also using an InjectManifest
plugin of Workbox
(https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin) to render a precache manifest that will then gets injected into a service worker file.
Here is a "plugins" section of my Webpack config file:
plugins: [
new CleanWebpackPlugin([ path.join(destDir, '*.*') ], {
allowExternal: true,
exclude: [],
verbose: true,
dry: false
}),
new MiniCssExtractPlugin({
filename: 'style.[hash].css'
}),
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
template: path.join(projectRoot, 'src/index.html')
}),
new WebpackPwaManifest({
name: 'Test PWA',
short_name: 'Test PWA',
fingerprints: true,
inject: true,
lang: 'en-US',
start_url: 'https://localhost:8120/index.html',
display: 'standalone',
theme_color: '#777777',
background_color: '#333333',
icons: [
{
src: path.join(sourceDir, 'images/icon.png'),
sizes: [36, 48, 72, 96, 144, 192, 512],
destination: 'icons'
}
]
}),
new InjectManifest({
swSrc: path.join(projectRoot, 'src/sw.js'),
swDest: 'sw.js',
importWorkboxFrom: 'local',
globPatterns: ['dist/*.{json,js,html}']
})
]
The problem is I cannot find a way to add a rendered manifest.hash.json
into a precache manifest generated by InjectManifest. Is there any way to make them play nicely together or is it not possible?