MCPcopy
hub / github.com/webpack/webpack / visit

Function visit

lib/hmr/LazyCompilationPlugin.js:112–131  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

110 if (!externals) return requests;
111 /** @param {import("../../declarations/WebpackOptions").ExternalItem} item one item */
112 const visit = (item) => {
113 if (typeof item === "string") {
114 requests.add(item);
115 return;
116 }
117 if (!item || typeof item !== "object" || item instanceof RegExp) return;
118 const resolved = /** @type {Record<string, unknown>} */ (
119 resolveByProperty(
120 /** @type {Record<string, unknown>} */ (item),
121 "byLayer",
122 layer
123 )
124 );
125 for (const [request, value] of Object.entries(resolved)) {
126 // `false` explicitly opts the request out of externalization; reserving
127 // it would pull the actual module into the entry chunk.
128 if (value === false) continue;
129 requests.add(request);
130 }
131 };
132 if (Array.isArray(externals)) {
133 for (const item of externals) visit(item);
134 } else {

Callers 2

topologicalSort.jsFile · 0.85

Calls 3

resolveByPropertyFunction · 0.85
entriesMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected