--- id: frontend.vite.dev-build-config title: Vite 8:开发服务器原理、Rolldown 构建、环境变量、代理(含 SSE)、插件和拆包 type: lesson domain: frontend stack: [vite] tags: [Vite, Rolldown, ESM, HMR, 环境变量, 代理, 插件, 虚拟模块, 拆包] level: intermediate prerequisites: [frontend.typescript.type-system] est_hours: 2.5 related: [frontend.webpack.build-optimization, frontend.vite.scenario.webpack-to-vite, frontend.vite.interview] week: [7] order: 1 --- # Vite 8:开发服务器原理、Rolldown 构建、环境变量、代理(含 SSE)、插件和拆包 > 基于 Vite 8.3 编写并实际构建验证。Vite 8 的生产构建改为基于 Rust 编写的 **Rolldown**(Vite 7 及以前:开发时用 esbuild 预构建依赖,生产用 Rollup 打包);`build.rollupOptions` 改名为 `build.rolldownOptions`(旧名仍可用但已标记弃用),拆包推荐 `output.codeSplitting`。以官方文档为准:https://vite.dev/guide/ 、https://rolldown.rs/ 。 ## 解释说明 ### 为什么开发时快 - **开发**:不打包。浏览器原生支持 ES 模块(`