MCPcopy
hub / github.com/webpack/webpack / apply

Method apply

lib/dependencies/ImportWeakDependency.js:56–74  ·  view source on GitHub ↗

* Applies the plugin by registering its hooks on the compiler. * @param {Dependency} dependency the dependency for which the template should be applied * @param {ReplaceSource} source the current replace source which can be modified * @param {DependencyTemplateContext} templateContext the cont

(
		dependency,
		source,
		{ runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements }
	)

Source from the content-addressed store, hash-verified

54 * @returns {void}
55 */
56 apply(
57 dependency,
58 source,
59 { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements }
60 ) {
61 const dep = /** @type {ImportWeakDependency} */ (dependency);
62 const content = runtimeTemplate.moduleNamespacePromise({
63 chunkGraph,
64 module: /** @type {Module} */ (moduleGraph.getModule(dep)),
65 request: dep.request,
66 strict: /** @type {BuildMeta} */ (module.buildMeta).strictHarmonyModule,
67 message: "import() weak",
68 weak: true,
69 dependency: dep,
70 runtimeRequirements
71 });
72
73 source.replace(dep.range[0], dep.range[1] - 1, content);
74 }
75};
76
77module.exports = ImportWeakDependency;

Callers

nothing calls this directly

Calls 3

getModuleMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected