Closed latipun7 closed 2 years ago
An alternative could be to create hook
compiler.hooks.thisCompilation.tap('FaviconsWebpackPlugin', compilation => {
compilation.hooks.processAssets.tapPromise(
{
name: 'FaviconsWebpackPlugin',
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
},
async () => {
const faviconCompilation = faviconCompilations.get(compilation);
if (!faviconCompilation) {
return;
}
const faviconAssets = (await faviconCompilation).assets;
// here we can alter the output - start hook (?)
for(const asset of faviconAssets) {
if(asset.name === 'manifest.json') {
asset.name = 'manifest.webmanifest'
faviconAssets.push(asset)
break
}
}
// here we can alter the output - end hook (?)
faviconAssets.forEach(({ name, contents }) => {
compilation.emitAsset(name, contents);
});
}
);
});
+1
In projects webpack here uses a rename plugin to rename the file after build, but it would be better if we could just directly set the right name.
Isn't manifest.webmanifest
a better default name too or is there still something around that uses manifest.json
?
This issue had no activity for at least half a year. It's subject to automatic issue closing if there is no activity in the next 15 days.
Still relevant ig
Is your feature request related to a problem? Please describe. Current outputted filename
manifest.json
is not a standard file extension for webmanifest. Correct manifest extension is.webmanifest
Describe the solution you'd like Allow custom filename in the configuration.
Describe alternatives you've considered Rename
manifest.json
in index file tosite.webmanifest
.Additional context