fix icons in manifest not being found

This commit is contained in:
Bruno Windels 2021-12-06 15:25:44 +01:00
parent 155cd4c9bd
commit 91e69a2bd0
2 changed files with 6 additions and 1 deletions

View File

@ -32,7 +32,10 @@ module.exports = function injectWebManifest(manifestFile) {
name: path.basename(iconFileName),
source: imgData
});
icon.src = this.getFileName(ref);
// we take the basename as getFileName gives the filename
// relative to the output dir, but the manifest is an asset
// just like they icon, so we assume they end up in the same dir
icon.src = path.basename(this.getFileName(ref));
}
const outputName = path.basename(absoluteManifestFile);
const manifestRef = this.emitFile({

View File

@ -47,6 +47,8 @@ export default {
// }, "hydrogen-legacy", [
// './legacy-polyfill',
// ]),
// important this comes before service worker
// otherwise the manifest and the icons it refers to won't be cached
injectWebManifest("assets/manifest.json"),
injectServiceWorker("sw.js"),
],