* Processes the provided file. * @param {string} file file name * @param {Source} source asset source * @param {AssetInfo} assetInfo extra asset information * @returns {void}
(file, source, assetInfo = {})
| 5126 | * @returns {void} |
| 5127 | */ |
| 5128 | emitAsset(file, source, assetInfo = {}) { |
| 5129 | class="cm">// A file may be attached to a chunk right after any emit (including the |
| 5130 | class="cm">// re-emit path for assets shared across chunks in createChunkAssets), so |
| 5131 | class="cm">// the lazily-built reverse index is stale after every emitAsset. |
| 5132 | this._assetToChunkIndex = undefined; |
| 5133 | this._assetToChunkAuxiliaryIndex = undefined; |
| 5134 | if (this.assets[file]) { |
| 5135 | if (!isSourceEqual(this.assets[file], source)) { |
| 5136 | this.errors.push( |
| 5137 | new WebpackError( |
| 5138 | `Conflict: Multiple assets emit different content to the same filename ${file}${ |
| 5139 | assetInfo.sourceFilename |
| 5140 | ? `. Original source ${assetInfo.sourceFilename}` |
| 5141 | : class="st">"" |
| 5142 | }` |
| 5143 | ) |
| 5144 | ); |
| 5145 | this.assets[file] = source; |
| 5146 | this._setAssetInfo(file, assetInfo); |
| 5147 | return; |
| 5148 | } |
| 5149 | const oldInfo = this.assetsInfo.get(file); |
| 5150 | const newInfo = { ...oldInfo, ...assetInfo }; |
| 5151 | this._setAssetInfo(file, newInfo, oldInfo); |
| 5152 | return; |
| 5153 | } |
| 5154 | this.assets[file] = source; |
| 5155 | this._setAssetInfo(file, assetInfo, undefined); |
| 5156 | } |
| 5157 | |
| 5158 | /** |
| 5159 | * Processes the provided file. |
no test coverage detected