Skip to content

@ogygia/data-shake · API

@ogygia/data-shake/vite

The dataShake() plugin, listed beside ogygia() in vite.config.

On this page

This page is generated from the package’s own .d.ts files on every build, so the signatures, descriptions and examples below always match the source.

Exports dataShake

import { … } from '@ogygia/data-shake/vite';

dataShake

function

Data shaking, listed beside ogygia() (plugins: [ogygia(), dataShake(), sveltekit()]): a page ships only the data its regions' code reads. Its first job is the page seed.

An island that reads page.data through $app/state / $app/stores gets the page seed. Without this plugin that seed is all of page.data, and every server hole looks it up. With it, the build reads each module once for the top-level page.data keys it can reach; the page ships only the keys its islands read, and a hole whose tree reads none skips the lookup. Any read the analysis cannot pin answers 'unknown', and that region gets all of page.data as before.

function dataShake(): OgygiaPlugin;