dreamonkey/responsive-image-plugin

Performance optimization

IlCallo opened this issue · 4 comments

  • Emit all files only at the end. Evaluate performance impact
  • Avoid emitting files which are never actually used (previous point)
  • Apply optimizations during image conversion in sharp converter for all possible formats
  • Add an option to strip metadata
  • Apply webpack performance optimizations to reduce build time
  • Decouple image optimization. Evaluate performance impact
  • Decouple size management, if possible
  • Calculate and save hash of source image + options, avoid processing if a match is found (incremental processing)

We should use cache-loader to avoid repeating processing for older images.
Unluckily, emitted files aren't cached: webpack-contrib/cache-loader#99
There is an unmerged solving PR: webpack-contrib/cache-loader#109

Since the package is deprecated (Webpack 5 manages cache natively), we should fork the project, apply the PR and re-publish it under our scope

Since the package is deprecated (Webpack 5 manages cache natively), we should fork the project, apply the PR and re-publish it under our scope

We bumped a new minor version which support webpack 5 only and added a section to leverage the built-in cache system instead

Transformation into a plugin broke native cache support, as we're not emitting files from the loader anymore with emitFile, but with emitAsset into the plugin, so they're not taken into consideration when running a subsequent build using the cache.
We need to re-enable it