diff --git a/lib/ChunkManifestPlugin.js b/lib/ChunkManifestPlugin.js index d7f2e03..c70cc30 100644 --- a/lib/ChunkManifestPlugin.js +++ b/lib/ChunkManifestPlugin.js @@ -38,7 +38,13 @@ ChunkManifestPlugin.prototype.apply = function(compiler) { oldChunkFilename = this.outputOptions.chunkFilename; this.outputOptions.chunkFilename = "__CHUNK_MANIFEST__"; // mark as asset for emitting - compilation.assets[manifestFilename] = new RawSource(JSON.stringify(chunkManifest)); + var mergedAssets; + if (compilation.assets[manifestFilename]) { + mergedAssets = Object.assign({}, JSON.parse(compilation.assets[manifestFilename]._value), chunkManifest); + } else { + mergedAssets = chunkManifest; + } + compilation.assets[manifestFilename] = new RawSource(JSON.stringify(mergedAssets)); chunk.files.push(manifestFilename); }