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

class NamedModulesPlugin {
	constructor(options) {
		this.options = options || {};
	}

	apply(compiler) {
		compiler.hooks.compilation.tap("NamedModulesPlugin", compilation => {
			compilation.hooks.beforeModuleIds.tap("NamedModulesPlugin", modules => {
				for (const module of modules) {
					if (module.id === null && module.libIdent) {
						module.id = module.libIdent({
							context: this.options.context || compiler.options.context
						});
					}
				}
			});
		});
	}
}

module.exports = NamedModulesPlugin;

@@ -362,16 +362,44 @@
 es =%3E %7B%0A
+%09%09%09%09let namedModules = %7B%7D;%0A%0A
 %09%09%09%09for 
@@ -422,24 +422,24 @@
  modules) %7B%0A
-
 %09%09%09%09%09if (mod
@@ -594,21 +594,482 @@
 %0A%09%09%09%09%09%7D%0A
-%09%09%09%09%7D
+%0A%09%09%09%09%09if (module.id) %7B%0A%09%09%09%09%09%09(namedModules%5Bmodule.id%5D && namedModules%5Bmodule.id%5D.push(module)) %7C%7C%0A%09%09%09%09%09%09%09(namedModules%5Bmodule.id%5D = Array.of(module));%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%0A%09%09%09%09Object.keys(namedModules).forEach(key =%3E %7B%0A%09%09%09%09%09const namedModule = namedModules%5Bkey%5D;%0A%09%09%09%09%09if (namedModule.length %3E 1) %7B%0A%09%09%09%09%09%09namedModule.forEach(module =%3E %7B%0A%09%09%09%09%09%09%09if (module.issuer && module.issuer.id) %7B%0A%09%09%09%09%09%09%09%09module.id = %60$%7Bmodule.issuer.id%7D~$%7Bmodule.id%7D%60;%0A%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%7D);%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D);
 %0A%09%09%09%7D);%0A

fix module name conflicts