Creates a new PreloadsManager instance
Configuration options including environment
Registers an array of preload modules to be imported later. Replaces any previously registered preloads.
Array of preload modules to register
Returns the PreloadsManager instance for method chaining
Changes the environment context for filtering preloads. Used when the application environment changes after manager creation.
The new environment to set
Returns the PreloadsManager instance for method chaining
Imports all registered preload modules that match the current environment. Clears the preloads list after importing to prevent duplicate imports.
Promise that resolves when all preload modules have been imported
The PreloadsManager class is used to resolve and import preload modules. Preload modules are files that should be loaded before the application starts, typically for initialization code or setup tasks.
The class relies on "import.meta.resolve" to resolve the provider modules from the root of the application.
Example