Vite + React + TS on Railway: image imports, unused imports, Node version
npm run build (tsc && vite build) fails on Railway with some combination of: (1) Cannot find module '../../Clients.png'; (2) unused-import errors ('StaggerContainer is declared but its value is never read'); (3) Nixpacks picking an older Node than Vite needs. Fixes: (1) Add asset module declarations in src/vite-env.d.ts: declare module '*.png' { const src: string; export default src; }. For files in public/, reference by URL (/Clients.png) instead of importing from outside src/. (2) tsc with noUnusedLocals fails the build on unused imports; Vite dev server does not catch this, only the build does. (3) Pin Node 20: add engines field in package.json, .nvmrc with 20, and nixpacks.toml with nixPkgs = ["nodejs_20", "npm-10_x"]. Source: sofiagrimm/yale-healthcare-consulting (e90a0da, bbd7a2a)