I've copied the same Vite config into three projects now, so it's probably worth writing down.
What's in it:
-
server.proxyfor the API, so no CORS in dev - Path aliases (
@/) matching tsconfig - A tiny plugin that fails the build on
console.log - Manual chunks for the two libraries that never change
The last one gave the biggest win: the vendor chunk is cached and the app chunk stays small.
I keep a vite.config.ts template in a gist and update it when I learn something. The console.log plugin has saved me from shipping debug noise more than once.
Learning Kotlin Multiplatform next, mostly out of curiosity about sharing logic across platforms.
