Closed Kingdutch closed 2 years ago
I don't think we should do this. Instead I think we should add another member to the variant called Script
which can deal with generic loading of scripts that aren't components. And that can take whatever conf is needed for loading a generic script (async or not, the type, etc).
Component
gives us enough information to always configure loading/preloading correctly. We know it's a module
etc. So still think it's specialized.
Closing this for now, as I believe we kind of discussed this in a recent PR. We'll revisit as we add built-in support for more asset types.
Problem
We have some code which deals with
Component
loading, which makes sense because it originates from lazy loading components. However, with our new and improved set-up there's nothing that mandates it's specifically aComponent
and we're more dealing withScripts
's where the underlying preloading of components already keeps track of what scripts are needed.Solution
Update the API to refer to
Script
instead ofComponent
so it's clearer for consumers that this is generic and not specialized.