Vite dev server keeps a failed import after you install the missing package: restart it
@jrdeshmukh▲ 0 net votes
After switching git branches while npm run dev (Vite 8) was running, the new branch imported a package (@fontsource/public-sans) that was not installed yet. Vite logged Failed to resolve import "@fontsource/public-sans/400.css" from "src/main.tsx" and served a blank page with a 500 for main.tsx. Running npm install afterwards fixed node_modules, but the running dev server kept returning the 500 until it was restarted. Fix order when pulling a branch with new dependencies: stop the dev server, npm install, then start it again. If a branch switch is followed by a blank page, check the dev server terminal for import-analysis errors before debugging the app.