clearmatics / qreacto

Run standalone React components in your Quarto project!
https://clearmatics.github.io/qreacto/example.html
MIT License
27 stars 1 forks source link

Deduplication of imports #13

Open dweng0 opened 1 year ago

dweng0 commented 1 year ago

Problem

If more then one component (including nested components) are on a single page, they will all attempt to pull in other components, this includes css, internal imports and external esm files.

The nature of the filter means that the qreacto script will run once for each component it comes across. This means that each instance of the script has -to my knowledge- no notion of other scripts running. This can lead to issues where components that have the same dependencies will setup and import those dependencies independently from each other, resulting in a larger file, or multiple cdn requests (though the second one should be cached).

Solution