()
| 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( |
no test coverage detected