Skip to content

Latest commit

 

History

History
77 lines (51 loc) · 2.73 KB

NEXTJS.md

File metadata and controls

77 lines (51 loc) · 2.73 KB

Next.js integration

Reference pattern: starters/mapsight-next-starter — Next.js App Router host loading Mapsight packages.

Use Next when the host application is already React/Next-centric (marketing site, municipal app shell, or future full-stack map pages).


Starter scope

  • Next.js 16 App Router alongside @mapsight/core and @mapsight/ui
  • Vector style compile step in build pipeline
  • Static asset copying of traffic-style icons to public/img/
  • UI chrome icons bundled from @mapsight/ui via SCSS ($ms3-iconPath: "~@mapsight/ui/dist/img/")
  • Client-side map mount in a "use client" component

It is a minimal copy-out template, not a production CMS replacement. For richer UI demos, use apps/demos.


Client vs server boundaries

Mapsight today assumes browser APIs (OpenLayers, DOM container). Map components should be client components ( "use client") or dynamically imported with ssr: false where Next would otherwise prerender the canvas.

SSR hydration: Next can SSR page chrome around the map. Mapsight’s dehydrated-state contract (SSR_HYDRATION.md) may align with Next SSR routes — evaluate; not mandated by the starter yet. See Decision 006.


i18n

No Next i18n library is chosen for Mapsight. Per-embed lang props and host-owned locale routing remain the status quo until Decision 008 selects an OSS i18n stack. Do not assume next-intl or similar in shared packages.


Build pipeline

Typical steps:

  1. vector-style-compiler — generate style modules under src/generated/
  2. Copy traffic-style icons to public/img/ (mapsight-icons*)
  3. next build --webpack — UI chrome icons from @mapsight/ui via SCSS; Webpack required for @mapsight/traffic-style subpath resolution today

From repo root:

pnpm --filter mapsight-next-starter dev
pnpm --filter mapsight-next-starter build

When Next vs CMS embed

Choose CMS embed Choose Next host
Editorial CMS owns pages App team owns all routes
Many topical embeds on one domain Map features are part of a JS application
PHP/Java CMS already in production Greenfield or Next-native stack

Communicative maps on Infosite/TYPO3 pages still favor CMS_PHP.md even when other site areas use Next.


Related