-
-
Notifications
You must be signed in to change notification settings - Fork 364
d2m #1461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
d2m #1461
Changes from all commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
094afce
feat: use rolldown to bundle config
sapphi-red dc2721a
chore: set `ROLLDOWN_OPTIONS_VALIDATION=loose` for vitepress
sapphi-red 7477a78
chore: merge main
sapphi-red 65fb861
chore: merge main
sapphi-red 42eca8b
chore: merge main
sapphi-red 164751c
chore: merge main
sapphi-red c147ae2
chore: merge main
sapphi-red 99c880e
chore: merge main
sapphi-red 8fd367f
chore: remove unnecessary workaround
sapphi-red 0cfc5bb
chore: merge main
sapphi-red d30fc40
chore: merge main
sapphi-red b995b34
chore: merge main
sapphi-red 612f536
chore: merge commit '86b5e0030bf204f8f2db0cf8ee895ab3ecf154b8' into r…
sapphi-red a0098e5
chore: merge commit 'a37ac836ac4da8e854d98c65450f12acb921aa98' into r…
sapphi-red b2d009a
Merge commit '61b6b96b191c6071b9c574ad4c795f97f2646f18' into rolldown…
sapphi-red 2bc2432
chore: merge commit 'a33d0c7d65d9fff9acd5de0cf3c4d371297b3990' into r…
sapphi-red f6f8386
chore: merge commit '24692dbeccd148a60f563bc96e12e3609e5ba642' into r…
sapphi-red 586ccc5
chore: merge commit '9c6cbe602187644887b0a4342de6b486c8f60f4d' into r…
sapphi-red 946692f
chore: merge main
sapphi-red 45e3a41
chore: merge main
sapphi-red f62acfd
chore: merge main
sapphi-red b54cd33
chore: merge main
sapphi-red 6b5516e
chore: fix docs build
sapphi-red 587fa33
chore: merge main
sapphi-red 49755dc
chore: merge main
sapphi-red 81ba548
chore: merge main
sapphi-red 303e850
chore: remove `ROLLDOWN_OPTIONS_VALIDATION=loose` from vitepress config
sapphi-red 5bb3903
chore: merge main
sapphi-red fa694cb
chore: merge main
sapphi-red f3c9bb9
chore: merge main
sapphi-red 5e5645b
chore: merge main
sapphi-red 975afc2
chore: merge main
sapphi-red 9934f7c
chore: merge main
sapphi-red a119488
feat: enable native resolver by default (#346)
sapphi-red ef38b75
chore: merge main
sapphi-red 850cf53
chore: merge main
sapphi-red 73846cb
chore: merge main
sapphi-red 6970a42
chore: merge main
sapphi-red 040b0ca
chore: merge main
sapphi-red 567b062
chore: merge main
sapphi-red 50f05ec
chore: merge main
sapphi-red dcb4874
chore: merge main
sapphi-red 4d772bd
chore: merge main
sapphi-red 6976d28
chore: merge main
sapphi-red 863e357
chore: merge main
sapphi-red 52bdbf4
chore: merge main
sapphi-red b64c453
chore: merge main
sapphi-red 024748a
feat: update rolldown (#456)
sapphi-red 3898900
chore: merge main
sapphi-red 88fe0a2
chore: merge main
sapphi-red 82aafa3
feat: update rolldown (#481)
sapphi-red 880c4e3
chore: merge main
sapphi-red ca48f6d
chore: merge main
sapphi-red d012b23
chore: merge main
sapphi-red 220fc89
feat: update rolldown to 1.0.0-beta.50 (#508)
sapphi-red 996709e
docs: migration guide (#469)
sapphi-red a5635e2
chore: merge main
sapphi-red f34a231
chore: merge main
sapphi-red b0f2c87
feat: update rolldown to 1.0.0-beta.52 (#522)
shulaoda e390394
chore: merge main
sapphi-red d3e337c
docs: update content for beta (#529)
sapphi-red f337511
docs: remove rolldown page (#528)
sapphi-red 8add1ce
chore: merge main
sapphi-red 21e1d45
docs: update migration guide. (#538)
cpojer bf15e07
feat: update rolldown to 1.0.0-beta.53 (#537)
shulaoda 283a277
feat!: update default browser target (#21193)
sapphi-red cba1f62
docs: add `resolve.tsconfigPaths` option docs (#21197)
sapphi-red 526217a
docs: add `emitDecoratorMetadata` description (#21198)
sapphi-red eedd9bc
docs: `alwaysStrict` does not affect the build result anymore (#21199)
sapphi-red db800be
docs: vite 8 beta announcement (#21196)
sapphi-red 73dbb45
docs: add overrides note in vite 8 beta post (#21201)
sapphi-red 9d1e98c
docs: update override instructions in release post (#21204)
TheAlexLichter e6e9263
docs(en): merging all conflicts
docschina-bot c64b509
docs: update content
lxKylin bb62f46
docs: update announcing-vite8-beta.md
lxKylin 5ae6127
docs: update content
lxKylin 79e5f69
Merge pull request #1457 from lxKylin/98c9-1
thinkasany 2e25b9f
Merge pull request #1456 from vitejs/sync-9d1e98c9-1
thinkasany File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| --- | ||
| title: 'Vite 8 Beta: The Rolldown-powered Vite' | ||
| author: | ||
| name: The Vite Team | ||
| date: 2025-12-03 | ||
| sidebar: false | ||
| head: | ||
| - - meta | ||
| - property: og:type | ||
| content: website | ||
| - - meta | ||
| - property: og:title | ||
| content: Announcing Vite 8 Beta | ||
| - - meta | ||
| - property: og:image | ||
| content: https://vite.dev/og-image-announcing-vite8-beta.webp | ||
| - - meta | ||
| - property: og:url | ||
| content: https://vite.dev/blog/announcing-vite8-beta | ||
| - - meta | ||
| - property: og:description | ||
| content: Vite 8 Beta Release Announcement | ||
| - - meta | ||
| - name: twitter:card | ||
| content: summary_large_image | ||
| --- | ||
|
|
||
| # Vite 8 Beta:由 Rolldown 驱动的 Vite {#vite-8-beta} | ||
|
|
||
| _2025年12月3日_ | ||
|
|
||
|  | ||
|
|
||
| 摘要:由 [Rolldown](https://rolldown.rs/) 驱动的 Vite 8 首个测试版现已发布。Vite 8 提供了显著更快的生产构建速度,并开启了未来的改进可能性。你可以通过将 `vite` 升级到 `8.0.0-beta.0` 版本并阅读[迁移指南](/guide/migration)来试用这个新版本。 | ||
|
|
||
| --- | ||
|
|
||
| 我们很高兴发布 Vite 8 的首个测试版。这个版本统一了底层工具链,带来了更好的一致性行为,以及显著的构建性能提升。Vite 现在使用 [Rolldown](https://rolldown.rs/) 作为其打包器,取代了之前 esbuild 和 Rollup 的组合。 | ||
|
|
||
| ## 面向 Web 的全新打包器 {#a-new-bundler-for-the-web} | ||
|
|
||
| Vite 之前依赖两个打包器来满足开发和生产构建的不同需求: | ||
|
|
||
| 1. 开发期间使用 esbuild 进行快速编译 | ||
| 2. 生产构建使用 Rollup 进行打包、分块和优化 | ||
|
|
||
| 这种方法让 Vite 能够专注于开发者体验和协调,而无需重新发明解析和打包功能。然而,维护两个独立的打包流水线引入了不一致性:独立的转换流水线、不同的插件系统,以及越来越多的粘合代码来保持开发和生产之间打包行为的一致性。 | ||
|
|
||
| 为了解决这个问题,[VoidZero 团队](https://voidzero.dev) 构建了 **Rolldown**,这是一个下一代打包器,目标是在 Vite 中使用。它的设计特点包括: | ||
|
|
||
| - **性能**:Rolldown 使用 Rust 编写,以原生速度运行。它的性能水平与 esbuild 相匹配,并且比 Rollup [快 10-30 倍](https://github.com/rolldown/benchmarks)。 | ||
| - **兼容性**:Rolldown 支持与 Rollup 和 Vite 相同的插件 API。大多数 Vite 插件在 Vite 8 中可以开箱即用。 | ||
| - **更多功能**:Rolldown 为 Vite 解锁了更多高级功能,包括完整打包模式、更灵活的分块控制、模块级持久缓存、模块联邦等。 | ||
|
|
||
| ## 统一工具链 {#unifying-the-toolchain} | ||
|
|
||
| Vite 打包器更换的影响超越了性能范畴。打包器利用解析器、解析器、转换器和压缩器。Rolldown 为此目的使用了由 VoidZero 团队主导的另一个项目 Oxc。 | ||
|
|
||
| **这使得 Vite 成为由同一团队维护的端到端工具链的入口:构建工具(Vite)、打包器(Rolldown)和编译器(Oxc)。** | ||
|
|
||
| 这种一致性确保了整个堆栈中的行为一致性,并且随着 JavaScript 的不断发展,使我们能够快速采用并与新的语言规范保持一致。这也解锁了以前仅凭 Vite 无法实现的广泛改进。例如,我们可以利用 Oxc 的语义分析在 Rolldown 中实现更好的 tree-shaking。 | ||
|
|
||
| ## Vite 如何迁移到 Rolldown {#how-vite-migrated-to-rolldown} | ||
|
|
||
| 迁移到由 Rolldown 驱动的 Vite 是一项基础性变革。因此,我们的团队采取了深思熟虑的步骤来实施这一变革,同时不牺牲稳定性和生态系统兼容性。 | ||
|
|
||
| 首先,我们发布了独立的 `rolldown-vite` 包作为[技术预览版](https://voidzero.dev/posts/announcing-rolldown-vite)。这让我们能够在不影响 Vite 稳定版本的情况下与早期采用者合作。早期采用者从 Rolldown 的性能提升中受益,同时提供了宝贵的反馈。亮点包括: | ||
|
|
||
| - Linear 的生产构建时间从 46 秒减少到 6 秒 | ||
| - Mercedes-Benz.io 将构建时间减少了高达 38% | ||
| - Beehiiv 将构建时间减少了 64% | ||
|
|
||
| 接下来,我们建立了一套测试套件,用于验证关键的 Vite 插件与 `rolldown-vite` 的兼容性。这项 CI 任务帮助我们及早发现回归问题和兼容性问题,特别是对于 SvelteKit、react-router 和 Storybook 等框架和元框架。 | ||
|
|
||
| 最后,我们构建了一个兼容层,帮助开发者从 Rollup 和 esbuild 选项迁移到相应的 Rolldown 选项。 | ||
|
|
||
| 因此,每个人都能顺利迁移到 Vite 8。 | ||
|
|
||
| ## 迁移到 Vite 8 Beta {#migrating-to-vite-8-beta} | ||
|
|
||
| 由于 Vite 8 涉及核心构建行为,我们专注于保持配置 API 和插件钩子不变。我们创建了[迁移指南](/guide/migration)来帮助您升级。 | ||
|
|
||
| 有两种可用的升级路径: | ||
|
|
||
| 1. **直接升级**:更新 `package.json` 并运行常规的开发和构建命令。 | ||
| 2. **渐进式迁移**:从 Vite 7 迁移到 `rolldown-vite` 包,然后再到 Vite 8。这样您可以识别出与 Rolldown 相关的不兼容性或问题,而不会对 Vite 造成其他更改。(推荐用于较大或复杂的项目) | ||
|
|
||
| > [!IMPORTANT] | ||
| > 如果你依赖特定的 Rollup 或 esbuild 选项,你可能需要对 Vite 配置进行一些调整。请参考[迁移指南](/guide/migration)获取详细的说明和示例。 | ||
| > 与所有非稳定的主版本一样,升级后建议进行全面测试以确保一切按预期工作。请务必报告任何[问题](https://github.com/vitejs/rolldown-vite/issues)。 | ||
|
|
||
| 如果你使用的框架或工具将 Vite 作为依赖项,例如 Astro、Nuxt 或 Vitest,你必须在 `package.json` 中覆盖 `vite` 依赖项,这根据你使用的包管理器略有不同: | ||
|
|
||
| :::code-group | ||
|
|
||
| ```json [npm] | ||
| { | ||
| "overrides": { | ||
| "vite": "8.0.0-beta.0" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ```json [Yarn] | ||
| { | ||
| "resolutions": { | ||
| "vite": "8.0.0-beta.0" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ```json [pnpm] | ||
| { | ||
| "pnpm": { | ||
| "overrides": { | ||
| "vite": "8.0.0-beta.0" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ```json [Bun] | ||
| { | ||
| "overrides": { | ||
| "vite": "8.0.0-beta.0" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ::: | ||
|
|
||
| 添加这些覆盖后,重新安装你的依赖项,然后像往常一样启动开发服务器或构建你的项目。 | ||
|
|
||
| ## Vite 8 的附加功能 {#additional-features-in-vite-8} | ||
|
|
||
| 除了搭载 Rolldown 之外,Vite 8 还带来了以下功能: | ||
|
|
||
| - **内置 tsconfig `paths` 支持**:开发者可以通过将 [`resolve.tsconfigPaths`](/config/shared-options.md#resolve-tsconfigpaths) 设置为 `true` 来启用此功能。此功能会带来轻微的性能成本,默认情况下未启用。 | ||
| - **`emitDecoratorMetadata` 支持**:Vite 8 现在内置了对 TypeScript [`emitDecoratorMetadata` 选项](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata)的自动支持。更多详情请参见[功能](/guide/features.md#emitdecoratormetadata)页面。 | ||
|
|
||
| ## 展望未来 {#looking-ahead} | ||
|
|
||
| 速度一直是 Vite 的标志性特性。与 Rolldown 的集成,以及延伸至 Oxc,意味着 JavaScript 开发者可以从 Rust 的速度中获益。升级到 Vite 8 应该会仅仅因为使用 Rust 而带来性能提升。 | ||
|
|
||
| 我们也即将推出 Vite 的完整打包模式,这将大幅提高大型项目的开发服务器速度。初步结果显示,开发服务器启动速度快了 3 倍,完全重新加载快了 40%,网络请求减少了 10 倍。 | ||
|
|
||
| 另一个标志性的 Vite 特性是插件生态系统。我们希望 JavaScript 开发者能够继续使用他们熟悉的 JavaScript 语言来扩展和定制 Vite,同时从 Rust 的性能提升中受益。我们的团队正在与 VoidZero 团队合作,以加速这些基于 Rust 系统中的 JavaScript 插件使用。 | ||
|
|
||
| 目前正在试验的即将到来的优化包括: | ||
|
|
||
| - [**原始 AST 传输**](https://github.com/oxc-project/oxc/issues/2409)。允许 JavaScript 插件以最小的开销访问 Rust 生成的 AST。 | ||
| - [**原生 MagicString 转换**](https://rolldown.rs/in-depth/native-magic-string#native-magicstring)。简单的自定义转换,逻辑在 JavaScript 中但计算在 Rust 中进行。 | ||
|
|
||
| ## **联系我们** {#connect-with-us} | ||
|
|
||
| 如果你已经尝试过 Vite 8 测试版,我们很希望听到你的反馈!请报告任何问题或分享你的使用体验: | ||
|
|
||
| - **Discord**:加入我们的[社区服务器](https://chat.vite.dev/)进行实时讨论 | ||
| - **GitHub**:在 [GitHub 讨论区](https://github.com/vitejs/vite/discussions)分享反馈 | ||
| - **问题报告**:在 [rolldown-vite 仓库](https://github.com/vitejs/rolldown-vite/issues)报告 bug 和回归问题 | ||
| - **成果分享**:在 [rolldown-vite-perf-wins 仓库](https://github.com/vitejs/rolldown-vite-perf-wins)分享你改善的构建时间 | ||
|
|
||
| 我们感谢所有的报告和复现案例。它们帮助我们朝着发布稳定版 8.0.0 的目标前进。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] There's a mix of terminology used for "minification" in Chinese. The text uses both "最小化压缩" and "最小化混淆" on this line. The term "最小化混淆" (minification and obfuscation) is technically more accurate than just "最小化" (minimization), but it should be consistent with other parts of the document. Line 135 uses "最小化压缩", so consider using consistent terminology throughout.