Hint
Separate third-party code (React, lodash) from app code — vendors change rarely so their chunk stays cached across deploys
Vendor chunk splitting separates third-party dependencies (React, ReactDOM, lodash, etc.) from your application code into a dedicated chunk.
Why it matters for caching:
// vite.config.ts
build: {
rollupOptions: {
output: {
manualChunks: {
'vendor-react': ['react', 'react-dom'],
'vendor-router': ['react-router-dom'],
'vendor-query': ['@tanstack/react-query'],
}
}
}
}
Result: users who visited before only need to download the small app chunk on the next deploy, not the large vendor chunk again.