Skip to content

Decouple component library from SvelteKit runtime ($app/environment → esm-env) #517

Description

@romanlamsal

What

Replace the $app/environment import in ChartList (ChartList.svelte, Row.svelte) with the framework-agnostic esm-env package (devDEV), and declare esm-env as a runtime dependency of @swr-data-lab/components.

Why

$app/environment is a virtual module that only exists inside SvelteKit. Because two components imported it, every non-SvelteKit consumer had to fake it: sophora-components carries a custom Vite resolveId shim, and Storybook only worked through @storybook/sveltekit's module mocking. esm-env (used by Svelte itself) provides the same flags through standard package export conditions and works in any bundler.

This removes the last SvelteKit runtime coupling from the published package and is a prerequisite for running Storybook on @storybook/svelte-vite (monorepo split) and for deleting the sophora shim.

Scope

Single change: two component files + one dependency entry. No behavior change (dev-flag semantics identical under Vite).

Activity

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