Skip to content

Svelte 5: import.meta.env crashes app if meta prop exists #14234

@kyoshino

Description

@kyoshino

Describe the bug

In Svelte 5, using import.meta.env crashes the application if there is a prop named meta in the component. The same issue happens with import.meta.glob.

Firefox says: Uncaught (in promise) TypeError: import.meta is not a function
Chrome says: Uncaught (in promise) TypeError: (intermediate value) is not a function

When this error happens, my SvelteKit site shows a blank page.

Reproduction

REPL: v4.2.19 / v5.1.13

This is a minimum version of my <MetaTags> component. With Svelte 4, REPL says just undefined but that’s fine, my code has no error. But with Svelte 5, this no longer works. I need to rename the prop. Uncommenting export let meta = {}; removes the error, saying undefined like Svelte 4.

Logs

No response

System Info

-

Severity

blocking an upgrade

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