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 // logic taken from CleanWebpackPlugin
const assets = // const assets =
stats.toJson( // stats.toJson(
{ // {
assets: true, // assets: true,
}, // },
true // true
).assets || []; // ).assets || [];
const assetList = assets.map((asset) => asset.name); // 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); const emittedAssets = Array.from(compilation.emittedAssets);
if (!prevAssets.length && emittedAssets.length < assetList.length) {
emittedAssets.push(...assetList);
}
const staleAssets = prevAssets.filter((asset) => { const staleAssets = prevAssets.filter((asset) => {
return assetList.includes(asset) === false; return assetList.includes(asset) === false;
}); });