apply(compiler) {
		const { _verbose: verbose } = this;
		compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
			const javascriptHooks =
				JavascriptModulesPlugin.getCompilationHooks(compilation);
			javascriptHooks.renderModulePackage.tap(
				PLUGIN_NAME,
				(
					moduleSource,
					module,
					{ chunk, chunkGraph, moduleGraph, runtimeTemplate }
				) => {
					const { requestShortener } = runtimeTemplate;
					let cacheEntry;
					let cache = caches.get(requestShortener);
					if (cache === undefined) {
						caches.set(requestShortener, (cache = new WeakMap()));
						cache.set(
							module,
							(cacheEntry = { header: undefined, full: new WeakMap() })
						);
					} else {
						cacheEntry = cache.get(module);
						if (cacheEntry === undefined) {
							cache.set(
								module,
								(cacheEntry = { header: undefined, full: new WeakMap() })
							);
						} else if (!verbose) {
							const cachedSource = cacheEntry.full.get(moduleSource);
							if (cachedSource !== undefined) return cachedSource;
						}
					}
					const source = new ConcatSource();
					let header = cacheEntry.header;
					if (header === undefined) {
						header = this.generateHeader(module, requestShortener);
						cacheEntry.header = header;
					}
					source.add(header);
					if (verbose) {
						const exportsType = /** @type {BuildMeta} */ (module.buildMeta)
							.exportsType;
						source.add(
							`${Template.toComment(
								exportsType
									? `${exportsType} exports`
									: "unknown exports (runtime-defined)"
							)}\n`
						);
						if (exportsType) {
							const exportsInfo = moduleGraph.getExportsInfo(module);
							printExportsInfoToSource(
								source,
								"",
								exportsInfo,
								moduleGraph,
								requestShortener
							);
						}
						source.add(
							`${Template.toComment(
								`runtime requirements: ${joinIterableWithComma(
									chunkGraph.getModuleRuntimeRequirements(module, chunk.runtime)
								)}`
							)}\n`
						);
						const optimizationBailout =
							moduleGraph.getOptimizationBailout(module);
						if (optimizationBailout) {
							for (const text of optimizationBailout) {
								const code =
									typeof text === "function" ? text(requestShortener) : text;
								source.add(`${Template.toComment(`${code}`)}\n`);
							}
						}
						source.add(moduleSource);
						return source;
					}
					source.add(moduleSource);
					const cachedSource = new CachedSource(source);
					cacheEntry.full.set(moduleSource, cachedSource);
					return cachedSource;
				}
			);
			javascriptHooks.chunkHash.tap(PLUGIN_NAME, (_chunk, hash) => {
				hash.update(PLUGIN_NAME);
				hash.update("1");
			});
			const cssHooks = CssModulesPlugin.getCompilationHooks(compilation);
			cssHooks.renderModulePackage.tap(
				PLUGIN_NAME,
				(moduleSource, module, { runtimeTemplate }) => {
					const { requestShortener } = runtimeTemplate;
					let cacheEntry;
					let cache = caches.get(requestShortener);
					if (cache === undefined) {
						caches.set(requestShortener, (cache = new WeakMap()));
						cache.set(
							module,
							(cacheEntry = { header: undefined, full: new WeakMap() })
						);
					} else {
						cacheEntry = cache.get(module);
						if (cacheEntry === undefined) {
							cache.set(
								module,
								(cacheEntry = { header: undefined, full: new WeakMap() })
							);
						} else if (!verbose) {
							const cachedSource = cacheEntry.full.get(moduleSource);
							if (cachedSource !== undefined) return cachedSource;
						}
					}
					const source = new ConcatSource();
					let header = cacheEntry.header;
					if (header === undefined) {
						header = this.generateHeader(module, requestShortener);
						cacheEntry.header = header;
					}
					source.add(header);
					source.add(moduleSource);
					const cachedSource = new CachedSource(source);
					cacheEntry.full.set(moduleSource, cachedSource);
					return cachedSource;
				}
			);
			cssHooks.chunkHash.tap(PLUGIN_NAME, (_chunk, hash) => {
				hash.update(PLUGIN_NAME);
				hash.update("1");
			});
		});
	}
@param {Compiler} compiler the compiler
@returns {void}