Sha256: cef61649b0d034ba1c5032a271487a8233c0b26ea35255f28bc71a44d8f1eda9

Contents?: true

Size: 768 Bytes

Versions: 7

Compression:

Stored size: 768 Bytes

Contents

/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
"use strict";

class MergeDuplicateChunksPlugin {

	apply(compiler) {
		compiler.plugin("compilation", (compilation) => {
			compilation.plugin("optimize-chunks-basic", (chunks) => {
				const map = Object.create(null);
				chunks.slice().forEach((chunk) => {
					if(chunk.hasRuntime() || chunk.hasEntryModule()) return;
					const ident = chunk.getModulesIdent();
					const otherChunk = map[ident];
					if(otherChunk) {
						if(otherChunk.integrate(chunk, "duplicate"))
							chunks.splice(chunks.indexOf(chunk), 1);
						return;
					}
					map[ident] = chunk;
				});
			});
		});
	}
}
module.exports = MergeDuplicateChunksPlugin;

Version data entries

7 entries across 3 versions & 2 rubygems

Version Path
optimacms-0.4.3 spec/dummy/node_modules/webpack/lib/optimize/MergeDuplicateChunksPlugin.js
optimacms-0.4.3 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/lib/optimize/MergeDuplicateChunksPlugin.js
optimacms-0.4.3 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/node_modules/webpack/lib/optimize/MergeDuplicateChunksPlugin.js
optimacms-0.4.2 spec/dummy/node_modules/webpack/lib/optimize/MergeDuplicateChunksPlugin.js
optimacms-0.4.2 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/lib/optimize/MergeDuplicateChunksPlugin.js
optimacms-0.4.2 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/node_modules/webpack/lib/optimize/MergeDuplicateChunksPlugin.js
cortex-0.1.3 spec/dummy/node_modules/webpack/lib/optimize/MergeDuplicateChunksPlugin.js