Skip to content

Svelte 5: Certain patterns of lazily loaded components fail #12663

@Conduitry

Description

@Conduitry

Describe the bug

The particular pattern below of lazily loading components fails, telling me that the lazily loaded component variable is not a function. This works in v4 and worked in previous versions of v5 (although I haven't checked when exactly it broke).

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACpWRW0vEMBCF_8oQH7aFpX3vDcTX_QdWJOYiwTQJzVSpof_dxLAX2CL4OJPvnEPOBCKVFp40z4EYOgnSkEfnyJHg6tLgP4VGEWdvl5mlTefZrBwOoxlRCwSuvNN0fWV2ctYIg9CDpNqL9kyc6LfS68lSLvjTmYqvXX21MuFByXuvLXl0uwZQR11oREzK1NuCaA1Y0zCt2EcfqF8Ng6KEfoCQkBGZNd5qUWn7Xuy6lm0G9yN7KOgXVQgqbmaE4lDVt2SV6zqUZcWFpIvG9p-5e23ivOQyt21IMrioujp_OjVRKxl7iJeaLFdSCU6aJNyOl8PeBv95YTdkFPQvC-ya54b7hJftByHNHTxGAgAA

Interestingly, this works: https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACpWRy2rEMAxFf0V1F5PAkOyTTGDodv6gKcX1o5g6tomVltTk32vXzAMmFLqUdHQlXQUilRaeNM-BGDoK0pCjc2RPcHEp8J9Co4ixt_PEUqbzbFIO-8EMqAUCV95purwyOzprhEE4gKTai_ZMnOi30svJUi7405mK1a6-SpnwqCQ83ImtSaR7mxGtAWsaphX7OATqF8OgKOHQQ0jIgMwab7WotH0vNieWbQY3i3Hpgn5RhaBiZkIodlV9S1bZiV1ZVlxIOmts_zl3yyic5uzTuvapDS5dXZ2PjuaERkQ7sxPby9eJqpWMTHzVaLmSSnDSJPl1f_nsbfOfL3Z9RkH_ssCuW7n-fsLL-gOK5_fWRwIAAA== - works, so it has something to do with the order that stuff is in the template it looks like.

Logs

Uncaught TypeError: LazilyLoadedComponent is not a function

  in App.svelte
    App playground:output:2662
    consequent_effect playground:output:2556
    update_reaction playground:output:1229
    update_effect playground:output:1401
    create_effect playground:output:407
    branch playground:output:539
    if_block playground:output:2556
    update_reaction playground:output:1229
    update_effect playground:output:1401
    process_effects playground:output:1562
    flush_queued_root_effects playground:output:1450
    process_deferred playground:output:1498
    App playground:output:2662
    consequent_effect playground:output:2556
    update_reaction playground:output:1229
    update_effect playground:output:1401
    create_effect playground:output:407
    branch playground:output:539
    if_block playground:output:2556
    update_reaction playground:output:1229
    update_effect playground:output:1401
    process_effects playground:output:1562
    flush_queued_root_effects playground:output:1450
    process_deferred playground:output:1498

System Info

REPL

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions