Skip to content

New state_referenced_locally warnings with svelte 5.45.3 #17289

@ahkelly

Description

@ahkelly

Describe the bug

When upgrading from svelte 5.45.2 to 5.45.3 a rash of new state_referenced_locally warnings pollute the terminal in dev and when attempting to npm run build. any of my existing apps with no build or dev warnings or errors now get spammed with mega volumes of anxiety inducing warnings.

Reverting to 5.45.2 for now resolves the issue.

Reproduction

Simply do a fresh install which as of now will use the "buggy" 5.45.3

npx sv create test_app_svelte_5453
SvelteKit minimal
cd create test_app_svelte_5453
npm run dev

you will see the warnings

 [vite-plugin-svelte] .svelte-kit/generated/root.svelte:11:27 This reference only captures the initial value of `stores`. Did you mean to reference it inside a closure instead?

Under npm run build you will get similar warnings (though the build will complete)

 [vite-plugin-svelte] .svelte-kit/generated/root.svelte:17:18 This reference only captures the initial value of `page`. Did you mean to reference it inside a closure instead?
https://svelte.dev/e/state_referenced_locally
15:     $effect.pre(() => stores.page.set(page));
16:   } else {
17:     stores.page.set(page);
                            ^
18:   }
19:   $effect(() => {

Logs

System Info

Linux Ubuntu 22, Node 24, npm 11.6.2

Severity

blocking an upgrade

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