aem-project-archetype icon indicating copy to clipboard operation
aem-project-archetype copied to clipboard

ui.frontend clientlib generation potential performance optimization

Open ahumphreys87 opened this issue 1 year ago • 0 comments

Expected Behaviour

The webpack build outputs 3 chunks: runtime, vendor, main. These 3 files should be loaded onto pages seperately in order to leverage browser caching in the most optimal manner.

Actual Behaviour

The clientlibs generator will create a single clientlib (clientlib-react) containing all 3 of these files. Bundling them together and creating its hash based on the content of all 3.

These means that whenever we make a change the "main" bundle, the hash of the clientlib changes causing browser cache to be busted.

If we had 3 clientlibs, each bundle would have its own independent cache and hash value.

Screenshot 2023-02-08 at 15 24 42

Reproduce Scenario (including but not limited to)

Steps to Reproduce

  1. Build the sample produced by the archetype using a react frontend
  2. Observe the js.txt definition of clientlibs-react

Platform and Version

All

Sample Code that illustrates the problem

Logs taken while reproducing problem

ahumphreys87 avatar Feb 08 '23 15:02 ahumphreys87