Skip to content

Snippet export - compiler treats $page as local declaration #14693

@notramo

Description

@notramo

Describe the bug

There is only a <script module> and no <script> in the component, but the snippet can not be exported, because the compiler treats the $page subscription as if it were local. If I remove the $ from $page, it can be exported.

Reproduction

<script module>
import { page } from '$app/stores';
export { exampleSnippet }; // type checker error: exampleSnippet not found (undefined export)
</script>

{#snippet exampleSnippet()}
  {JSON.stringify($page.data)}
{/snippet}

Logs

No response

System Info

-

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions