@@ -524,18 +524,13 @@ function lsSaveAll(models: Record<string, ContractModel>): void {
524524 localStorage . setItem ( LS_KEY , JSON . stringify ( models ) ) ;
525525}
526526
527- // Seed JSONs imported at build time so the demo starts populated. The publish
528- // flow copies these files from `../data/*.json` into the public repo (see
529- // `scripts/publish-app.sh`'s data-file copy step) so the imports resolve at
530- // build time both in the monorepo and in the standalone clone.
531- import stripeCustomersSeed from '$data/stripe-customers-contract.json' ;
532- import stripeSubscriptionsSeed from '$data/stripe-subscriptions-contract.json' ;
533- import stripeInvoicesSeed from '$data/stripe-invoices-contract.json' ;
534- const DEMO_SEED_MODELS : ContractModel [ ] = [
535- stripeCustomersSeed as unknown as ContractModel ,
536- stripeSubscriptionsSeed as unknown as ContractModel ,
537- stripeInvoicesSeed as unknown as ContractModel
538- ] ;
527+ // NOTE: demo-mode seed imports live in `./demo-seed.ts`, NOT here. That file
528+ // uses the `$data` Vite alias (only defined in the standalone app's own
529+ // vite.config.ts) and is imported only by the SA `+page.svelte`. The Context
530+ // Plane frontend transitively imports this store through the data-contract
531+ // package's converter exports, so any `$data/...` imports added at module
532+ // scope here would break the CP dev build with "Failed to resolve import".
533+ // Keep that aliased path confined to demo-seed.ts.
539534
540535// --- API helpers -----------------------------------------------------------
541536
@@ -738,19 +733,13 @@ function makeExampleModel(): ContractModel {
738733
739734export async function initStore ( ) {
740735 if ( store . loaded ) return ;
741- let models = await apiListModels ( ) ;
742-
743- // In demo mode, if localStorage is empty seed all four example contracts
744- // (3 Stripe + 1 Receipts) so visitors land on a populated app instead of
745- // a single example. Normal SA install seeds just the example contract via
746- // the existing `models.length === 0` branch below.
747- if ( DEMO_MODE && models . length === 0 ) {
748- for ( const m of DEMO_SEED_MODELS ) {
749- const migrated = migrateModel ( JSON . parse ( JSON . stringify ( m ) ) as Record < string , unknown > ) ;
750- await apiCreateModel ( migrated ) ;
751- }
752- models = await apiListModels ( ) ;
753- }
736+ const models = await apiListModels ( ) ;
737+
738+ // Demo-mode seeding (when localStorage is empty) is handled by the SA
739+ // `+page.svelte` calling `seedDemoIfEmpty()` from `./demo-seed.ts` BEFORE
740+ // initStore runs. The store stays generic so the CP frontend can import
741+ // this module via the converter without pulling in the SA-only `$data`
742+ // alias.
754743
755744 if ( models . length === 0 ) {
756745 const example = makeExampleModel ( ) ;
0 commit comments