Migrate from Vite to Next.js 16 App Router#188
Merged
Merged
Conversation
Mirrors the cbo-baseline-tracker shape so this repo follows the same PolicyEngine Next.js layout: Tailwind v4 via @tailwindcss/postcss, @policyengine/ui-kit theme tokens, eslint-config-next flat config, bun lockfile. The single-page tracker stays a client app (window-driven routing, ResizeObserver, PostHog) and is loaded through next/dynamic with ssr:false so the metadata-rich layout renders on the server while the interactive surface boots on the client. SEO metadata, JSON-LD, Google Analytics, and the noscript fallback are ported from index.html into app/layout.jsx via the Next metadata API. Vite-specific bits removed: vite.config.js, eslint.config.js, the legacy .npmrc (Bun handles peer deps), package-lock.json, src/main.jsx, and import.meta.env references (replaced with NEXT_PUBLIC_*). The PostHog proxy moves from a Vite middleware to a Next rewrite, and basePath.js now guards window access for SSR safety. Two pre-existing useEffects that mirror data into state synchronously get a scoped react-hooks/set-state-in-effect disable comment; the new React 19 rule flagged them but refactoring would change behavior. The modal_app.py deploy still expects dist/ from a Vite build and will need a follow-up update once this lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Sorry @MaxGhenis, only members of the PolicyEngine/core-developers team can invoke Claude Code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@tailwindcss/postcss,@policyengine/ui-kit0.9.x theme tokens. Mirrors thecbo-baseline-trackerlayout used across PolicyEngine Next.js apps.index.htmlSEO (metadata, JSON-LD, GA scripts,noscriptfallback) intosrc/app/layout.jsxvia the Next metadata API. The interactive tracker loads throughnext/dynamicwithssr: falseso the SSR-rendered layout keeps full SEO while the window-driven SPA boots on the client.import.meta.env.VITE_*withprocess.env.NEXT_PUBLIC_*, swap the Vite PostHog middleware for a Next rewrite, guardwindowaccess inlib/basePath.js, drop.npmrc, commitbun.lock, native flat ESLint viaeslint-config-next(no FlatCompat), nooutput: "standalone"/output: "export".Notes
useEffectblocks that mirror data into state synchronously get a scopedreact-hooks/set-state-in-effectdisable; refactoring would change runtime behavior, so the React 19 rule is silenced inline rather than rewriting.modal_app.pystill expectsdist/from a Vite build andscripts/prerender.mjswrites there. The Modal deploy and the prerender pipeline will need a follow-up to target Next's output. Not addressed here to keep the PR focused on the framework swap.Test plan
bun run lintclean (0 errors, 10 pre-existing warnings)bun run buildsucceeds and statically prerenders/bun run test31/31 passbun run devreturns 200 with full SEO metadata in initial HTMLGenerated with Claude Code