Closed ivancuric closed 7 years ago
Would doing:
{
cache: JSON.parse(fs.readFileSync(...))
}
be enough or should we add an options to handle that?
cc @gmac
This is actually a fairly well-defined use case in multi-compiler architectures where we want a single manifest that documents output from all compilers. This can be achieved by passing a shared cache object to all plugin instances, such as:
var manifest = {};
var compiler1 = { ..., plugins: [ new WebpackManifestPlugin({ cache: manifest }) ] };
var compiler2 = { ..., plugins: [ new WebpackManifestPlugin({ cache: manifest }) ] };
Note that this pattern requires a single object instance to be shared; the system won't work as expected if you pass unique object clones to each plugin instance.
@gmac Yeah I got that, but do you think the code I posted above is alright to handle merging with an existing manifest.json in the case of a single compiler?
@mastilver yep, looks right to me!
module.exports = {
// ...
plugins: [
new ManifestPlugin({
cache: JSON.parse(fs.readFileSync(path.join(__dirname, 'manifest.json'))
})
]
};
Any ideas on how to merge with an existing manifest.json generated by other processes?