AdonisJS API
    Preparing search index...

    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.

    const manager = new PreloadsManager({ environment: 'web' })
    manager.use([{ file: () => import('./preloads/routes'), environment: ['web'] }])
    await manager.import()
    Index
    • Registers an array of preload modules to be imported later. Replaces any previously registered preloads.

      Parameters

      • list: PreloadNode[]

        Array of preload modules to register

      Returns this

      Returns the PreloadsManager instance for method chaining

    • Changes the environment context for filtering preloads. Used when the application environment changes after manager creation.

      Parameters

      Returns this

      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.

      Returns Promise<void>

      Promise that resolves when all preload modules have been imported