wip: watchstate plugin adjustments

This commit is contained in:
Igor Randjelovic
2022-04-21 23:40:38 +02:00
committed by Nathan Walker
parent 33ab7d27b7
commit a6d19e9716

View File

@ -55,16 +55,24 @@ export class WatchStatePlugin {
}
// logic taken from CleanWebpackPlugin
const assets =
stats.toJson(
{
assets: true,
},
true
).assets || [];
const assetList = assets.map((asset) => asset.name);
// const assets =
// stats.toJson(
// {
// assets: true,
// },
// true
// ).assets || [];
// const assetList = assets.map((asset) => asset.name);
// const emittedAssets = Array.from(compilation.emittedAssets);
const assetList = Object.keys(compilation.assets);
const emittedAssets = Array.from(compilation.emittedAssets);
if (!prevAssets.length && emittedAssets.length < assetList.length) {
emittedAssets.push(...assetList);
}
const staleAssets = prevAssets.filter((asset) => {
return assetList.includes(asset) === false;
});