Skip to content

Add a hook to run some code during preloading code #12544

@CNSeniorious000

Description

@CNSeniorious000

Describe the problem

Some module is large, but not compatible with SSR. So I can only import it dynamically in an onMount or if (browser) block. But I still want them to be preloaded during that page got preloaded by preloadCode or data-sveltekit-preload-code.

An example is monaco-editor.

Describe the proposed solution

Add a hook like beforePreload in $app/navigation.

Alternatives considered

For now I can only write them in on:mouseover besides data-sveltekit-preload-code or write them after preloadCode

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions