hoistModulesInChunks(compilation, depsToTrace, entryExternalsToHoist) {
		const { chunkGraph, moduleGraph } = compilation;

		// loop over entry points
		for (const dep of entryExternalsToHoist) {
			const entryModule = moduleGraph.getModule(dep);
			if (!entryModule) continue;
			// get all the external module types and hoist them to the runtime chunk, this will get RemoteModule externals
			const allReferencedModules = getAllReferencedModules(
				compilation,
				entryModule,
				"external",
				false
			);

			const containerRuntimes = chunkGraph.getModuleRuntimes(entryModule);
			const runtimes = new Set();

			for (const runtimeSpec of containerRuntimes) {
				forEachRuntime(runtimeSpec, runtimeKey => {
					if (runtimeKey) {
						runtimes.add(runtimeKey);
					}
				});
			}

			for (const runtime of runtimes) {
				const runtimeChunk = compilation.namedChunks.get(runtime);
				if (!runtimeChunk) continue;

				for (const module of allReferencedModules) {
					if (!chunkGraph.isModuleInChunk(module, runtimeChunk)) {
						chunkGraph.connectChunkAndModule(runtimeChunk, module);
					}
				}
			}
			this.cleanUpChunks(compilation, allReferencedModules);
		}

		// handle container entry specifically
		for (const dep of depsToTrace) {
			const containerEntryModule = moduleGraph.getModule(dep);
			if (!containerEntryModule) continue;
			const allReferencedModules = getAllReferencedModules(
				compilation,
				containerEntryModule,
				"initial",
				false
			);

			const allRemoteReferences = getAllReferencedModules(
				compilation,
				containerEntryModule,
				"external",
				false
			);

			for (const remote of allRemoteReferences) {
				allReferencedModules.add(remote);
			}

			const containerRuntimes =
				chunkGraph.getModuleRuntimes(containerEntryModule);
			const runtimes = new Set();

			for (const runtimeSpec of containerRuntimes) {
				forEachRuntime(runtimeSpec, runtimeKey => {
					if (runtimeKey) {
						runtimes.add(runtimeKey);
					}
				});
			}

			for (const runtime of runtimes) {
				const runtimeChunk = compilation.namedChunks.get(runtime);
				if (!runtimeChunk) continue;

				for (const module of allReferencedModules) {
					if (!chunkGraph.isModuleInChunk(module, runtimeChunk)) {
						chunkGraph.connectChunkAndModule(runtimeChunk, module);
					}
				}
			}
			this.cleanUpChunks(compilation, allReferencedModules);
		}
	}
Hoist modules in chunks.
@param {Compilation} compilation The webpack compilation instance.
@param {Set<Dependency>} depsToTrace Set of container entry dependencies.
@param {Set<Dependency>} entryExternalsToHoist Set of container entry dependencies to hoist.