MCPcopy
hub / github.com/webpack/webpack / _validateCompilersOptions

Method _validateCompilersOptions

lib/MultiCompiler.js:151–184  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149 }
150
151 _validateCompilersOptions() {
152 if (this.compilers.length < 2) return;
153 /**
154 * Adds the provided compiler to the multi compiler.
155 * @param {Compiler} compiler compiler
156 * @param {WebpackError} warning warning
157 */
158 const addWarning = (compiler, warning) => {
159 compiler.hooks.thisCompilation.tap(CLASS_NAME, (compilation) => {
160 compilation.warnings.push(warning);
161 });
162 };
163 /** @type {Set<string>} */
164 const cacheNames = new Set();
165 for (const compiler of this.compilers) {
166 if (compiler.options.cache && "name" in compiler.options.cache) {
167 const name = /** @type {string} */ (compiler.options.cache.name);
168 if (cacheNames.has(name)) {
169 addWarning(
170 compiler,
171 new WebpackError(
172 `${
173 compiler.name
174 ? `Compiler with name "${compiler.name}" doesn't use unique cache name. `
175 : ""
176 }Please set unique "cache.name" option. Name "${name}" already used.`
177 )
178 );
179 } else {
180 cacheNames.add(name);
181 }
182 }
183 }
184 }
185
186 get options() {
187 return Object.assign(

Callers 1

constructorMethod · 0.95

Calls 3

addWarningFunction · 0.85
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected