MCPcopy
hub / github.com/webpack/webpack / applyEntryOption

Method applyEntryOption

lib/EntryOptionPlugin.js:60–94  ·  view source on GitHub ↗

* Apply entry option. * @param {Compiler} compiler the compiler * @param {string} context context directory * @param {Entry} entry request * @returns {void}

(compiler, context, entry)

Source from the content-addressed store, hash-verified

58 * @returns {void}
59 */
60 static applyEntryOption(compiler, context, entry) {
61 if (typeof entry === "function") {
62 const DynamicEntryPlugin = require("./DynamicEntryPlugin");
63
64 new DynamicEntryPlugin(context, entry).apply(compiler);
65 } else {
66 const EntryPlugin = require("./EntryPlugin");
67
68 for (const name of Object.keys(entry)) {
69 const desc = entry[name];
70 const options = EntryOptionPlugin.entryDescriptionToOptions(
71 compiler,
72 name,
73 desc
74 );
75 const descImport =
76 /** @type {Exclude<EntryDescription["import"], undefined>} */
77 (desc.import);
78 // A plugin (e.g. HtmlModulesPlugin) may rewrite the entry into a
79 // single synthetic request; otherwise each import becomes an entry.
80 const request = EntryOptionPlugin.getHooks(compiler).entry.call(
81 context,
82 name,
83 desc
84 );
85 if (request !== undefined) {
86 new EntryPlugin(context, request, options).apply(compiler);
87 } else {
88 for (const entry of descImport) {
89 new EntryPlugin(context, entry, options).apply(compiler);
90 }
91 }
92 }
93 }
94 }
95
96 /**
97 * Entry description to options.

Callers 4

applyMethod · 0.80
loader.jsFile · 0.80
applyMethod · 0.80
applyMethod · 0.80

Calls 6

getHooksMethod · 0.80
applyMethod · 0.65
keysMethod · 0.65
requireFunction · 0.50
callMethod · 0.45

Tested by

no test coverage detected