src/loader.js
/**
   * Overwrite internal module informations for proper output filename generation.
   * A hacky workaround until the module renaming Webpack API will be released.
   * See: https://github.com/webpack/webpack/issues/14851
   * 
   * @param {ImageData} resultImageData 
   * @param {String} finalPath 
   */
Overwrite internal module informations for proper output filename generation.
A hacky workaround until the module renaming Webpack API will be released.


Overwrite internal module informations for proper output filename generation . A hacky workaround until the module renaming Webpack API will be released .
updateModuleData(resultImageData, finalPath) {
    this.context.resourcePath = finalPath;
    this.context._module.matchResource = finalPath;
    const { buffer, ...imageInfo } = resultImageData;
    if (
      this.context._module &&
      this.context._module.resourceResolveData &&
      this.context._module.resourceResolveData.encodedContent
    ) {
      this.context._module.resourceResolveData.encodedContent =
        buffer.toString("base64");
    }
    if (this.context._module) {
      this.context._module.buildMeta = {
        ...this.context._module.buildMeta,
        infoOptimized: imageInfo
      };
    }
  }
updateModuleData ( resultImageData , finalPath ) { this . context . resourcePath = finalPath ; this . context . _module . matchResource = finalPath ; const { buffer , ... imageInfo } = resultImageData ; if ( this . context . _module && this . context . _module . resourceResolveData && this . context . _module . resourceResolveData . encodedContent ) { this . context . _module . resourceResolveData . encodedContent = buffer . toString ( "base64" ) ; } if ( this . context . _module ) { this . context . _module . buildMeta = { ... this . context . _module . buildMeta , infoOptimized : imageInfo } ; } }
Overwrite internal module informations for proper output filename generation.
Overwrite internal module informations for proper output filename generation .
// Change content of the data URI after the conversion // Only if encodedContent was generated before (needs to update) // update build meta information (whatever is it for) // todo: is it still needed? no docs available...