Menu

Vite config that survived three projects
📰

Vite config that survived three projects

DEV Community: typescript·Logan Jenkins·1 day ago
#qNvfJvfv
#devtotypescript#devto#dev#vite#config
Reading 0:00
15s threshold

Logan Jenkins

I've copied the same Vite config into three projects now, so it's probably worth writing down.

What's in it:

  • server.proxy for 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.