Skip to content

SvelteKit 3 - @vercel/analytics initialization error #221

Open

Description

@vexy

When trying to initialize analytics, under SveteKit v3, following error appears in console:

Uncaught (in promise) SvelteKit error: app_stores_removed
`$app/stores` has been removed in favour of `$app/state`

... sometimes preventing the functionality of the entire app thereafter.

The problem

In short, the problem is that SvelteKit 3 deprecated usage of $app/stores stating that proper way from now on is to use $app/state - as stated in the error message.

This only happens with following dependencies in place (others omitted for brevity):

"@sveltejs/kit": "^3.2.0",
"@sveltejs/vite-plugin-svelte": "^7.3.1",
"@vercel/analytics": "^2.0.1",
"@vercel/speed-insights": "^2.1.0",
"svelte": "^5.57.3",
"typescript": "^6.0.3",
"vite": "^8.3.8"

Proposed solution

IMHO, the fix would be to change the imports in following file: https://github.com/vercel/analytics/blob/main/packages/web/src/sveltekit/index.ts

Lines 3 and 4, should be:

import { browser } from '$app/env';
import { page } from '$app/state';

instead of current

import { browser } from '$app/environment';
import { page } from '$app/stores';

For older SvelteKit versions nothing should be changed. This is just for SvelteKit 3 (and on).

Activity

  1. vexy commented on Nov 18, 2026

    @vexy
    Author

    This is related to #204 and #216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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