Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

1.5 KB
Raw Blame
// The shell module runs the i18n/nav/search bootstrap on import — it must
// execute before the plugin imports below so plugins can call i18n.t at
// module load. (Side-effect imports are ordering barriers.)
import { createDashboardRouter, Dashboard } from '@spree/dashboard'
import { createRoot } from 'react-dom/client'
// Activate installed dashboard plugins — synthesized by spreeDashboardPlugin()
// from your package.json deps. `pnpm add <plugin>` + dev-server restart is the
// whole install; this line never changes.
import 'virtual:spree-dashboard-plugins'
// Your own customizations (nav entries, routes, slot widgets, table columns).
import './plugins'
import './styles.css'
// Generated by @spree/dashboard/vite on every dev start and build: the
// shell's routes composed with every installed plugin's file routes. Commit
// it — its diff on upgrades shows exactly which admin pages changed.
import { routeTree } from './routeTree.gen'

// basepath mirrors Vite's `base` so sub-path mounts (/dashboard on the
// single-node topology) route correctly; '/' in dev and root deploys.
const router = createDashboardRouter(routeTree, { basepath: import.meta.env.BASE_URL })

// Registers the composed router program-wide so <Link> and navigation are
// type-checked against the real route tree — shell, host, and plugin routes.
declare module '@tanstack/react-router' {
  interface Register {
    router: typeof router
  }
}

createRoot(document.getElementById('root')!).render(<Dashboard router={router} />)