diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 3b819e0b..2055fc5f 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -49,8 +49,10 @@ export default defineConfig({ pattern: 'https://github.com/vitejs/docs-cn/edit/main/:path', text: '为此页提供修改建议', }, - - outlineTitle: '本页目录', + + outline: { + label: '本页目录' + }, socialLinks: [ { icon: 'mastodon', link: 'https://elk.zone/m.webtoo.ls/@vite' }, @@ -65,7 +67,45 @@ export default defineConfig({ indexName: 'vitejs', searchParameters: { facetFilters: ['tags:cn'] - } + }, + placeholder: '搜索文档', + translations: { + button: { + buttonText: '搜索' + }, + modal: { + searchBox: { + resetButtonTitle: '清除查询条件', + resetButtonAriaLabel: '清除查询条件', + cancelButtonText: '取消', + cancelButtonAriaLabel: '取消' + }, + startScreen: { + recentSearchesTitle: '搜索历史', + noRecentSearchesText: '没有搜索历史', + saveRecentSearchButtonTitle: '保存到搜索历史', + removeRecentSearchButtonTitle: '从搜索历史中移除', + favoriteSearchesTitle: '收藏', + removeFavoriteSearchButtonTitle: '从收藏中移除' + }, + errorScreen: { + titleText: '无法获取结果', + helpText: '你可能需要检查你的网络连接' + }, + footer: { + selectText: '选择', + navigateText: '切换', + closeText: '关闭', + searchByText: '搜索供应商' + }, + noResultsScreen: { + noResultsText: '无法找到相关结果', + suggestedQueryText: '你可以尝试查询', + reportMissingResultsText: '你认为这个查询应该有结果?', + reportMissingResultsLinkText: '向我们反馈' + } + } + }, }, carbonAds: { diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..cbe5ad16 --- /dev/null +++ b/LICENSE @@ -0,0 +1,437 @@ +Attribution-NonCommercial-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International +Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-NonCommercial-ShareAlike 4.0 International Public License +("Public License"). To the extent this Public License may be +interpreted as a contract, You are granted the Licensed Rights in +consideration of Your acceptance of these terms and conditions, and the +Licensor grants You such rights in consideration of benefits the +Licensor receives from making the Licensed Material available under +these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-NC-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution, NonCommercial, and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. NonCommercial means not primarily intended for or directed towards + commercial advantage or monetary compensation. For purposes of + this Public License, the exchange of the Licensed Material for + other material subject to Copyright and Similar Rights by digital + file-sharing or similar means is NonCommercial provided there is + no payment of monetary compensation in connection with the + exchange. + + l. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + m. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + n. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part, for NonCommercial purposes only; and + + b. produce, reproduce, and Share Adapted Material for + NonCommercial purposes only. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties, including when + the Licensed Material is used other than for NonCommercial + purposes. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-NC-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database for NonCommercial purposes + only; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/README.md b/README.md index c345a62c..08c81897 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ $ pnpm dev ## 版权声明 -本仓库所包含的中文翻译内容(即所有 `.md` 文件),其版权为 Vite 官方中文翻译团队所有。除官方中文文档 [cn.vitejs.dev](https://cn.vitejs.dev) 之外,不得在其它域名下进行未经授权的转载或部署。 +知识共享许可协议
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 (CC BY-NC-SA 4.0) 进行许可。 ## 贡献者统计 @@ -65,5 +65,7 @@ $ pnpm dev > 头像图生成逻辑参见:[github-contributor-svg-generator](https://github.com/ShenQingchuan/github-contributor-svg-generator)

- + + +

diff --git a/config/build-options.md b/config/build-options.md index 24333c69..917674ee 100644 --- a/config/build-options.md +++ b/config/build-options.md @@ -129,7 +129,7 @@ Git LFS 占位符会自动排除在内联之外,因为它们不包含它们所 - **类型:** `boolean | 'inline' | 'hidden'` - **默认:** `false` -构建后是否生成 source map 文件。如果为 `true`,将会创建一个独立的 source map 文件。如果为 `'inline'`,source map 将作为一个 data URI 附加在输出文件中。`'hidden'` 的工作原理与 `'true'` 相似,只是 bundle 文件中相应的注释将不被保留。 +构建后是否生成 source map 文件。如果为 `true`,将会创建一个独立的 source map 文件。如果为 `'inline'`,source map 将作为一个 data URI 附加在输出文件中。`'hidden'` 的工作原理与 `true` 相似,只是 bundle 文件中相应的注释将不被保留。 ## build.rollupOptions {#build-rollupoptions} diff --git a/config/dep-optimization-options.md b/config/dep-optimization-options.md index 2ca2f031..aed451b7 100644 --- a/config/dep-optimization-options.md +++ b/config/dep-optimization-options.md @@ -49,7 +49,7 @@ export default defineConfig({ - **类型:** [`EsbuildBuildOptions`](https://esbuild.github.io/api/#simple-options) -在部署扫描和优化过程中传递给 esbuild 的选项。 +在依赖扫描和优化过程中传递给 esbuild 的选项。 某些选项进行了省略,因为修改它们与 Vite 的优化方案并不兼容。 @@ -78,7 +78,7 @@ export default defineConfig({ ## optimizeDeps.needsInterop -- **Experimental** -- **Type:** `string[]` +- **实验性** +- **类型:** `string[]` -Forces ESM interop when importing these dependencies. Vite is able to properly detect when a dependency needs interop, so this option isn't generally needed. However, different combinations of dependencies could cause some of them to be prebundled differently. Adding these packages to `needsInterop` can speed up cold start by avoiding full-page reloads. You'll receive a warning if this is the case for one of your dependencies, suggesting to add the package name to this array in your config. +当导入这些依赖项时,会强制 ESM 转换。Vite 能够正确检测到依赖项是否需要转换处理(interop),因此通常不需要使用此选项。然而,不同的依赖项组合可能导致其中一些包以不同方式预构建。将这些包添加到 `needsInterop` 中可以通过避免重新加载整个页面、加快冷启动速度。如果某个依赖项符合此情况,Vite 将抛出警告,建议你在配置中添加该包名。 diff --git a/config/preview-options.md b/config/preview-options.md index 88df5f98..b72b0971 100644 --- a/config/preview-options.md +++ b/config/preview-options.md @@ -3,7 +3,7 @@ ## preview.host {#preview-host} - **类型:** `string | boolean` -- **默认:** [`server.host`](#server_host) +- **默认:** [`server.host`](./server-options#server-host) 为开发服务器指定 ip 地址。 设置为 `0.0.0.0` 或 `true` 会监听所有地址,包括局域网和公共地址。 @@ -40,23 +40,23 @@ export default defineConfig({ ## preview.strictPort {#preview-strictport} - **类型:** `boolean` -- **默认:** [`server.strictPort`](#server_strictport) +- **默认:** [`server.strictPort`](./server-options#server-strictport) 设置为 `true` 时,如果端口已被使用,则直接退出,而不会再进行后续端口的尝试。 ## preview.https {#preview-https} - **类型:** `boolean | https.ServerOptions` -- **默认:** [`server.https`](#server_https) +- **默认:** [`server.https`](./server-options#server-https) -启用 TLS + HTTP/2。注意,只有在与 [`server.proxy` 选项](#server-proxy) 同时使用时,才会降级为 TLS。 +启用 TLS + HTTP/2。注意,只有在与 [`server.proxy` 选项](./server-options#server-proxy) 同时使用时,才会降级为 TLS。 该值也可以传递给 `https.createServer()` 的 [options 对象](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener)。 ## preview.open {#preview-open} - **类型:** `boolean | string` -- **默认:** [`server.open`](#server_open) +- **默认:** [`server.open`](./server-options#server-open) 开发服务器启动时,自动在浏览器中打开应用程序。当该值为字符串时,它将被用作 URL 的路径名。如果你想在你喜欢的某个浏览器打开该开发服务器,你可以设置环境变量 `process.env.BROWSER` (例如 `firefox`)。欲了解更多细节,请参阅 [`open` 包的源码](https://github.com/sindresorhus/open#app)。 @@ -74,7 +74,7 @@ export default defineConfig({ ## preview.cors {#preview-cors} - **类型:** `boolean | CorsOptions` -- **默认:** [`server.cors`](#server_proxy) +- **默认:** [`server.cors`](./server-options#server-cors) 为开发服务器配置 CORS。此功能默认启用并支持任何来源。可传递一个 [options 对象](https://github.com/expressjs/cors#configuration-options) 来进行配置,或者传递 `false` 来禁用此行为。 @@ -82,4 +82,4 @@ export default defineConfig({ - **类型:** `OutgoingHttpHeaders` -指明服务器返回的响应头。 \ No newline at end of file +指明服务器返回的响应头。 diff --git a/config/server-options.md b/config/server-options.md index 6900f771..53716067 100644 --- a/config/server-options.md +++ b/config/server-options.md @@ -16,7 +16,7 @@ 第一种情况是 `localhost` 被使用了。Node.js 在 v17 以下版本中默认会对 DNS 解析地址的结果进行重新排序。当访问 `localhost` 时,浏览器使用 DNS 来解析地址,这个地址可能与 Vite 正在监听的地址不同。当地址不一致时,Vite 会打印出来。 -你可以设置 [`dns.setDefaultResultOrder('verbatim')`](https://nodejs.org/api/dns.html#dns_dns_setdefaultresultorder_order) 来禁用这个重新排序的行为。Vite 将会将改地址打印为 `localhost`。 +你可以设置 [`dns.setDefaultResultOrder('verbatim')`](https://nodejs.org/api/dns.html#dns_dns_setdefaultresultorder_order) 来禁用这个重新排序的行为。Vite 会将地址打印为 `localhost`。 ```js // vite.config.js @@ -34,7 +34,6 @@ export default defineConfig({ ::: - ::: tip 在 WSL2 中通过 LAN 访问开发服务器 当你在 WSL2 运行 Vite 时,仅设置 `host: true` 来从局域网访问服务器是不够的。 @@ -214,13 +213,11 @@ export default defineConfig({ ## server.middlewareMode {#server-middlewaremode} - **类型:** `'ssr' | 'html'` +- **默认值:** `false` -以中间件模式创建 Vite 服务器。(不含 HTTP 服务器) - -- `'ssr'` 将禁用 Vite 自身的 HTML 服务逻辑,因此你应该手动为 `index.html` 提供服务。 -- `'html'` 将启用 Vite 自身的 HTML 服务逻辑。 +以中间件模式创建 Vite 服务器。 -- **相关:** [SSR - 设置开发服务器](/guide/ssr#setting-up-the-dev-server) +- **相关:** [appType](./shared-options#apptype),[SSR - 设置开发服务器](/guide/ssr#setting-up-the-dev-server) - **示例:** @@ -240,9 +237,10 @@ async function createServer() { app.use(vite.middlewares) app.use('*', async (req, res) => { - // 如果 `middlewareMode` 是 `'ssr'`,应在此为 `index.html` 提供服务. - // 如果 `middlewareMode` 是 `'html'`,则此处无需手动服务 `index.html` - // 因为 Vite 自会接管 + // 由于 `appType` 的值是 `'custom'`,因此应在此处提供响应。 + // 请注意:如果 `appType` 值为 `'spa'` 或 `'mpa'`,Vite 会包含 + // 处理 HTML 请求和 404 的中间件,因此用户中间件应该在 + // Vite 的中间件之前添加,以确保其生效。 }) } @@ -309,9 +307,7 @@ export default defineConfig({ - **类型:** `string[]` - **默认:** `['.env', '.env.*', '*.{crt,pem}']` -用于限制 Vite 开发服务器提供敏感文件的黑名单。 - -默认为 `['.env', '.env.*', '*.{pem,crt}']`。这会比 [`server.fs.allow`](#server-fs-allow) 选项的优先级更高。同时还支持 [picomatch patterns](https://github.com/micromatch/picomatch#globbing-features)。 +用于限制 Vite 开发服务器提供敏感文件的黑名单。这会比 [`server.fs.allow`](#server-fs-allow) 选项的优先级更高。同时还支持 [picomatch 模式](https://github.com/micromatch/picomatch#globbing-features)。 ## server.origin {#server-origin} diff --git a/guide/api-javascript.md b/guide/api-javascript.md index 55a518db..71dc0a14 100644 --- a/guide/api-javascript.md +++ b/guide/api-javascript.md @@ -34,7 +34,7 @@ const __dirname = fileURLToPath(new URL('.', import.meta.url)) ``` ::: tip 注意 -当在同一个 Node.js 进程中使用 `createServer` 和 `build` 时,两个函数都依赖于 `process.env.NODE_ENV` 才可正常工作,而这个环境变量又依赖于 `mode` 配置项。为了避免行为冲突,请在这两个 API 传入参数 `development` 字段中设置 `process.env.NODE_ENV` 或者 `mode` 配置项,或者你也可以生成另一个子进程,分别运行这两个 API。 +当在同一个 Node.js 进程中使用 `createServer` 和 `build` 时,两个函数都依赖于 `process.env.NODE_ENV` 才可正常工作,而这个环境变量又依赖于 `mode` 配置项。为了避免行为冲突,请在使用这两个 API 时为 `process.env.NODE_ENV` 或者 `mode` 配置项、字段设置参数值 `development`,或者你也可以生成另一个子进程,分别运行这两个 API。 ::: ## `InlineConfig` {#inlineconfig} @@ -265,11 +265,7 @@ function mergeConfig( 深度合并两份配置。`isRoot` 代表着 Vite 配置被合并的层级。举个例子,如果你是要合并两个 `build` 选项请设为 `false`。 ::: tip NOTE -`mergeConfig` accepts only config in object form. If you have a config in callback form, you should call it before passing into `mergeConfig`. -::: - -::: tip NOTE -`mergeConfig` accepts only config in object form. If you have a config in callback form, you should call it before passing into `mergeConfig`. +`mergeConfig` 只接受对象形式的配置。如果有一个回调形式的配置,应该在将其传递给 `mergeConfig` 之前先调用该回调函数,将其转换成对象形式。 ::: ## `searchForWorkspaceRoot` diff --git a/guide/api-plugin.md b/guide/api-plugin.md index 7ce92d94..30de389a 100644 --- a/guide/api-plugin.md +++ b/guide/api-plugin.md @@ -161,7 +161,7 @@ console.log(msg) 它们还有一个扩展的 `options` 参数,包含其他特定于 Vite 的属性。你可以在 [SSR 文档](/guide/ssr#ssr-specific-plugin-logic) 中查阅更多内容。 -一些 `resolveId` 调用的 `importer` 值可能是根目录下的通用 `index.html` 的绝对路径,因为由于 Vite 非打包的开发服务器模式无法始终推导出实际的导入者。对于在 Vite 的解析管道中处理的导入,导入者可以在导入分析阶段进行跟踪,那时所提供的 `importer` 值是正确的。 +一些 `resolveId` 调用的 `importer` 值可能是根目录下的通用 `index.html` 的绝对路径,这是由于 Vite 非打包的开发服务器模式无法始终推断出实际的导入者。对于在 Vite 的解析管道中处理的导入,可以在导入分析阶段跟踪导入者,提供正确的 `importer` 值。 以下钩子在服务器关闭时被调用: diff --git a/guide/comparisons.md b/guide/comparisons.md index 861918b4..bc3e4eae 100644 --- a/guide/comparisons.md +++ b/guide/comparisons.md @@ -6,7 +6,7 @@ Preact 团队的 [WMR](https://github.com/preactjs/wmr) 提供了类似的特性 WMR 主要是为了 [Preact](https://preactjs.com/) 项目而设计,并为其提供了集成度更高的功能,比如预渲染。就使用范围而言,它更加贴合于 Preact 框架,与 Preact 本身一样强调紧凑的大小。如果你正在使用 Preact,那么 WMR 可能会提供更好的体验。 -## @web/dev-server {#webdev-server} +## @web/dev-server {#web-dev-server} [@web/dev-server](https://modern-web.dev/docs/dev-server/overview/)(曾经是 `es-dev-server`)是一个伟大的项目,基于 koa 的 Vite 1.0 开发服务器就是受到了它的启发。 @@ -16,6 +16,6 @@ WMR 主要是为了 [Preact](https://preactjs.com/) 项目而设计,并为其 ## Snowpack {#snowpack} -[Snowpack](https://www.snowpack.dev/) 也是一个与 Vite 十分类似的非构建式原生 ESM 开发服务器。该项目已经不维护了。团队目前正在开发 [Astro](https://astro.build/),一个由 Vite 驱动的静态站点构建工具。Astro 团队目前是我们生态中非常活跃的成员,它们帮助 Vite 进益良多。 +[Snowpack](https://www.snowpack.dev/) 也是一个与 Vite 十分类似的非构建式原生 ESM 开发服务器。该项目已经不维护了。团队目前正在开发 [Astro](https://astro.build/),一个由 Vite 驱动的静态站点构建工具。Astro 团队目前是我们生态中非常活跃的成员,他们帮助 Vite 进益良多。 -除了不同的实现细节外,这两个项目在技术上比传统工具有很多共同优势。Vite 的依赖预构建也受到了 Snowpack v1(现在是 [`esinstall`](https://github.com/snowpackjs/snowpack/tree/main/esinstall))的启发。若想了解 Vite 同这两个项目之间的一些主要区别,可以查看 [the v2 Comparisons Guide](https://v2.vitejs.dev/guide/comparisons)。 +除了不同的实现细节外,这两个项目在技术上比传统工具有很多共同优势。Vite 的依赖预构建也受到了 Snowpack v1(现在是 [`esinstall`](https://github.com/snowpackjs/snowpack/tree/main/esinstall))的启发。若想了解 Vite 同这两个项目之间的一些主要区别,可以查看 [Vite v2 比较指南](https://v2.vitejs.dev/guide/comparisons)。 diff --git a/guide/dep-pre-bundling.md b/guide/dep-pre-bundling.md index 81f0ca01..86a0e152 100644 --- a/guide/dep-pre-bundling.md +++ b/guide/dep-pre-bundling.md @@ -6,30 +6,30 @@ 这就是 Vite 执行时所做的“依赖预构建”。这个过程有两个目的: -1. **CommonJS 和 UMD 兼容性:** 开发阶段中,Vite 的开发服务器将所有代码视为原生 ES 模块。因此,Vite 必须先将作为 CommonJS 或 UMD 发布的依赖项转换为 ESM。 +1. **CommonJS 和 UMD 兼容性:** 在开发阶段中,Vite 的开发服务器将所有代码视为原生 ES 模块。因此,Vite 必须先将以 CommonJS 或 UMD 形式提供的依赖项转换为 ES 模块。 - 当转换 CommonJS 依赖时,Vite 会执行智能导入分析,这样即使导出是动态分配的(如 React),按名导入也会符合预期效果: + 在转换 CommonJS 依赖项时,Vite 会进行智能导入分析,这样即使模块的导出是动态分配的(例如 React),具名导入(named imports)也能正常工作: ```js // 符合预期 import React, { useState } from 'react' ``` -2. **性能:** Vite 将有许多内部模块的 ESM 依赖关系转换为单个模块,以提高后续页面加载性能。 +2. **性能:** 为了提高后续页面的加载性能,Vite将那些具有许多内部模块的 ESM 依赖项转换为单个模块。 - 一些包将它们的 ES 模块构建作为许多单独的文件相互导入。例如,[`lodash-es` 有超过 600 个内置模块](https://unpkg.com/browse/lodash-es/)!当我们执行 `import { debounce } from 'lodash-es'` 时,浏览器同时发出 600 多个 HTTP 请求!尽管服务器在处理这些请求时没有问题,但大量的请求会在浏览器端造成网络拥塞,导致页面的加载速度相当慢。 + 有些包将它们的 ES 模块构建为许多单独的文件,彼此导入。例如,[`lodash-es` 有超过 600 个内置模块](https://unpkg.com/browse/lodash-es/)!当我们执行 `import { debounce } from 'lodash-es'` 时,浏览器同时发出 600 多个 HTTP 请求!即使服务器能够轻松处理它们,但大量请求会导致浏览器端的网络拥塞,使页面加载变得明显缓慢。 - 通过预构建 `lodash-es` 成为一个模块,我们就只需要一个 HTTP 请求了! + 通过将 `lodash-es` 预构建成单个模块,现在我们只需要一个HTTP请求! ::: tip 注意 -依赖预构建仅会在开发模式下应用,并会使用 `esbuild` 将依赖转为 ESM 模块。在生产构建中则会使用 `@rollup/plugin-commonjs`。 +依赖预构建仅适用于开发模式,并使用 `esbuild` 将依赖项转换为 ES 模块。在生产构建中,将使用 `@rollup/plugin-commonjs`。 ::: ## 自动依赖搜寻 {#automatic-dependency-discovery} -如果没有找到相应的缓存,Vite 将抓取你的源码,并自动寻找引入的依赖项(即 "bare import",表示期望从 `node_modules` 解析),并将这些依赖项作为预构建包的入口点。预构建通过 `esbuild` 执行,所以它通常非常快。 +如果没有找到现有的缓存,Vite 会扫描您的源代码,并自动寻找引入的依赖项(即 "bare import",表示期望从 `node_modules` 中解析),并将这些依赖项作为预构建的入口点。预打包使用 `esbuild` 执行,因此通常速度非常快。 -在服务器已经启动之后,如果遇到一个新的依赖关系导入,而这个依赖关系还没有在缓存中,Vite 将重新运行依赖构建进程并根据需要重新加载页面。 +在服务器已经启动后,如果遇到尚未在缓存中的新依赖项导入,则 Vite 将重新运行依赖项构建过程,并在需要时重新加载页面。 ## Monorepo 和链接依赖 {#monorepos-and-linked-dependencies} @@ -50,15 +50,15 @@ export default defineConfig({ }) ``` -当这个被链接的依赖发生变更后,在重启开发服务器时在命令中带上 `--force` 选项让所有更改生效。 +当对链接的依赖进行更改时,请使用 `--force` 命令行选项重新启动开发服务器,以使更改生效。 ::: warning 重复删除 -由于对链接依赖的解析方式不同,传递性的依赖项可能会不正确地进行重复数据删除,而造成运行时的问题。如果你偶然发现了这个问题,请使用 `npm pack` 来修复它。 +由于链接的依赖项解析方式不同,传递依赖项(transitive dependencies)可能会被错误地去重,从而在运行时出现问题。如果遇到此问题,请使用 `npm pack` 命令来修复它。 ::: ## 自定义行为 {#customizing-the-behavior} -默认的依赖项发现为启发式可能并不总是可取的。在你想要显式地从列表中包含/排除依赖项的情况下, 请使用 [`optimizeDeps` 配置项](/config/dep-optimization-options.md)。 +有时候默认的依赖启发式算法(discovery heuristics)可能并不总是理想的。如果您想要明确地包含或排除依赖项,可以使用 [`optimizeDeps` 配置项](/config/dep-optimization-options.md) 来进行设置。 `optimizeDeps.include` 或 `optimizeDeps.exclude` 的一个典型使用场景,是当 Vite 在源码中无法直接发现 import 的时候。例如,import 可能是插件转换的结果。这意味着 Vite 无法在初始扫描时发现 import —— 只能在文件被浏览器请求并转换后才能发现。这将导致服务器在启动后立即重新打包。 @@ -70,21 +70,21 @@ export default defineConfig({ ### 文件系统缓存 {#file-system-cache} -Vite 会将预构建的依赖缓存到 `node_modules/.vite`。它根据几个源来决定是否需要重新运行预构建步骤: +Vite 将预构建的依赖项缓存到 `node_modules/.vite` 中。它会基于以下几个来源来决定是否需要重新运行预构建步骤: -- 包管理器的 lockfile 内容,例如 `package-lock.json`,`yarn.lock`,`pnpm-lock.yaml`,或者 `bun.lockb` -- 补丁文件夹的修改时间 -- 可能在 `vite.config.js` 相关字段中配置过的 -- `NODE_ENV` 中的值 +- 包管理器的锁文件内容,例如 `package-lock.json`,`yarn.lock`,`pnpm-lock.yaml`,或者 `bun.lockb`; +- 补丁文件夹的修改时间; +- `vite.config.js` 中的相关字段; +- `NODE_ENV` 的值。 只有在上述其中一项发生更改时,才需要重新运行预构建。 -如果出于某些原因,你想要强制 Vite 重新构建依赖,你可以用 `--force` 命令行选项启动开发服务器,或者手动删除 `node_modules/.vite` 目录。 +如果出于某些原因你想要强制 Vite 重新构建依赖项,你可以在启动开发服务器时指定 `--force` 选项,或手动删除 `node_modules/.vite` 缓存目录。 ### 浏览器缓存 {#browser-cache} -解析后的依赖请求会以 HTTP 头 `max-age=31536000,immutable` 强缓存,以提高在开发时的页面重载性能。一旦被缓存,这些请求将永远不会再到达开发服务器。如果安装了不同的版本(这反映在包管理器的 lockfile 中),则附加的版本 query 会自动使它们失效。如果你想通过本地编辑来调试依赖项,你可以: +已预构建的依赖请求使用 HTTP 头 `max-age=31536000, immutable` 进行强缓存,以提高开发期间页面重新加载的性能。一旦被缓存,这些请求将永远不会再次访问开发服务器。如果安装了不同版本的依赖项(这反映在包管理器的 lockfile 中),则会通过附加版本查询自动失效。如果你想通过本地编辑来调试依赖项,您可以: -1. 通过浏览器调试工具的 Network 选项卡暂时禁用缓存; -2. 重启 Vite dev server,并添加 `--force` 命令以重新构建依赖; +1. 通过浏览器开发工具的 Network 选项卡暂时禁用缓存; +2. 重启 Vite 开发服务器指定 `--force` 选项,来重新构建依赖项; 3. 重新载入页面。 diff --git a/guide/features.md b/guide/features.md index 9aa3c4c3..61b06e92 100644 --- a/guide/features.md +++ b/guide/features.md @@ -366,7 +366,7 @@ const modules = { ### Glob 导入形式 {#glob-import-as} -`import.meta.glob` 都支持以字符串形式导入文件,类似于 [以字符串形式导入资源](https://vitejs.dev/guide/assets.html#importing-asset-as-string)。在这里,我们使用了 [Import Reflection](https://github.com/tc39/proposal-import-reflection) 语法对导入进行断言: +`import.meta.glob` 都支持以字符串形式导入文件,类似于 [以字符串形式导入资源](./assets.html#importing-asset-as-string)。在这里,我们使用了 [Import Reflection](https://github.com/tc39/proposal-import-reflection) 语法对导入进行断言: ```js const modules = import.meta.glob('./dir/*.js', { as: 'raw', eager: true }) diff --git a/guide/ssr.md b/guide/ssr.md index 3a4ae7b4..8210cdc7 100644 --- a/guide/ssr.md +++ b/guide/ssr.md @@ -242,7 +242,7 @@ export function mySSRPlugin() { } ``` -`options` 中的 `load` 和 `transform` 为可选项,rollup 目前并未使用该对象,但将来可能会用额外的元数据来扩展这些钩子函数。 +`load` 和 `transform` 中的 `options` 对象为可选项,rollup 目前并未使用该对象,但将来可能会用额外的元数据来扩展这些钩子函数。 :::tip Note Vite 2.7 之前的版本,会提示你 `ssr` 参数的位置不应该是 `options` 对象。目前所有主要框架和插件都已对应更新,但你可能还是会发现使用过时 API 的旧文章。 diff --git a/guide/static-deploy.md b/guide/static-deploy.md index 03049069..01aa9eea 100644 --- a/guide/static-deploy.md +++ b/guide/static-deploy.md @@ -62,10 +62,10 @@ $ npm run preview 如果你要部署在 `https://.github.io//` 上,例如你的仓库地址为 `https://github.com//`,那么请设置 `base` 为 `'//'`。 -2. 在你的项目中,创建一个 `deploy.sh` 脚本,包含以下内容(注意高亮的行,按需使用),运行脚本来部署站点: +2. 进入仓库 settings 页面的 GitHub Pages 配置,选择部署来源为“GitHub Actions”,这将引导你创建一个构建和部署项目的工作流程,我们提供了一个安装依赖项和使用 npm 构建的工作流程样本: ```yml - # Simple workflow for deploying static content to GitHub Pages + # 将静态内容部署到 GitHub Pages 的简易工作流程 name: Deploy static content to Pages on: @@ -74,7 +74,7 @@ $ npm run preview branches: ['main'] # 这个选项可以使你手动在 Action tab 页面触发工作流 - workflow_dispatch: + workflow_dispatch: # 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages。 permissions: @@ -150,7 +150,9 @@ $ npm run preview - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ``` -## Netlify CLI {#netlify} +## Netlify {#netlify} + +### Netlify CLI {#netlify-cli} 1. 安装 [Netlify CLI](https://cli.netlify.com/)。 2. 使用 `ntl init` 创建一个新站点。 @@ -207,7 +209,7 @@ Vercel CLI 3. Vercel 会检测到你正在使用 Vite,并会为你的部署开启相应的正确配置。 4. 你的应用被部署好了!(示例:[vite-vue-template.vercel.app](https://vite-vue-template.vercel.app/)) -在你的项目被导入和部署后,所有对分支的后续推送都会生成 [预览部署](https://vercel.com/docs/concepts/deployments/environments#preview),而所有对生产分支(通常是 ”main“)的更改都会生成一个 [生产构建](https://vercel.com/docs/concepts/deployments/environments#production) +在你的项目被导入和部署后,所有对分支的后续推送都会生成 [预览部署](https://vercel.com/docs/concepts/deployments/environments#preview),而所有对生产分支(通常是“main”)的更改都会生成一个 [生产构建](https://vercel.com/docs/concepts/deployments/environments#production) 查看 Vercel 的 [Git 集成](https://vercel.com/docs/concepts/git) 了解更多细节。 @@ -305,13 +307,13 @@ $ npx wrangler pages publish dist 安装完此扩展后,进入你应用的根目录。打开 SWA 的扩展程序,登录 Azure,并点击 '+',来创建一个全新的 SWA。系统会提示你指定所需的订阅 key。 -按照扩展程序的启动向导,给你的应用程序起个名字,选择框架预设,并指定应用程序的根目录(通常为 `/`)以及构建文件的路径 `/dist`。此向导完成后,会在你的 repo 中的 `.github` 文件夹中创建一个 Github Action。 +按照扩展程序的启动向导,给你的应用程序起个名字,选择框架预设,并指定应用程序的根目录(通常为 `/`)以及构建文件的路径 `/dist`。此向导完成后,会在你的 repo 中的 `.github` 文件夹中创建一个 GitHub Action。 -这个 action 致力于部署你的应用程序(可以在仓库的 Actions 标签中,查看相关进度),成功完成后,你可以点击 Github 中出现的 “浏览站点” 的按钮,查看你的应用程序。 +这个 action 致力于部署你的应用程序(可以在仓库的 Actions 标签中,查看相关进度),成功完成后,你可以点击 GitHub 中出现的 “浏览站点” 的按钮,查看你的应用程序。 ## Render {#render} -你可以在 [Render](https://render.com/) 你的 Vite 应用。 +你可以在 [Render](https://render.com/) 部署你的 Vite 应用。 1. 创建一个 [Render 账号](https://dashboard.render.com/register) @@ -330,7 +332,7 @@ $ npx wrangler pages publish dist 默认情况下,推送到该指定分支的任何新的 commit 都会自动触发一个新的部署。[Auto-Deploy](https://render.com/docs/deploys#toggling-auto-deploy-for-a-service) 可以在项目设置中部署。 -还可以为在项目添加一个 [自定义域名](https://render.com/docs/custom-domains)。 +还可以为项目添加一个 [自定义域名](https://render.com/docs/custom-domains)。 ## Flightcontrol diff --git a/guide/troubleshooting.md b/guide/troubleshooting.md index af715753..46a2d952 100644 --- a/guide/troubleshooting.md +++ b/guide/troubleshooting.md @@ -88,7 +88,7 @@ security add-trusted-cert -d -r trustRoot -k ~/Library/Keychains/login.keychain- 或者,通过将其导入 Keychain Access 应用程序并将您的证书的信任更新为“始终信任”。 -### 431 Request Header Fields Too Large {#431-request-header-fields-too-large} +### 431 Request Header Fields Too Large {#_431-request-header-fields-too-large} 当服务器或 WebSocket 服务收到一个较大的 HTTP 头,该请求可能会被遗落并且会显示下面这样的警告。 @@ -122,7 +122,7 @@ import './Foo.js' // 应该为 './foo.js' ### 控制台中大量热更新 {#high-number-of-hmr-updates-in-console} -This can be caused by a circular dependency. To solve this, try breaking the loop. +这可能是由循环依赖引起的。要解决这个问题,请先尝试解决依赖循环。 ## 构建 {#build} @@ -154,9 +154,9 @@ This can be caused by a circular dependency. To solve this, try breaking the loo 这是因为 Vite 不会自动 polyfill Node.js 的内建模块。 -我们推荐你不要再浏览器中使用 Node.js 模块以减小包体积,尽管你可以为其手动添加 polyfill。如果该模块是被某个第三方库(这里意为某个在浏览器中使用的库)导入的,则建议向对应库提交一个 issue。 +我们推荐你不要在浏览器中使用 Node.js 模块以减小包体积,尽管你可以为其手动添加 polyfill。如果该模块是被某个第三方库(这里意为某个在浏览器中使用的库)导入的,则建议向对应库提交一个 issue。 -### Syntax Error / Type Error {#syntax-error-type-error-happens} +### 出现 Syntax Error 或 Type Error {#syntax-error-type-error-happens} Vite 无法处理、也不支持仅可在非严格模式(sloppy mode)下运行的代码。这是因为 Vite 使用了 ESM 并且始终在 ESM 中使用 [严格模式](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode)。 diff --git a/package.json b/package.json index 9a9c9cc7..b98c1e76 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "repository": "https://github.com/vitejs/docs-cn", "author": "Evan You", "private": true, + "license": "CC BY-NC-SA 4.0", "devDependencies": { "chalk": "^4.1.0", "gray-matter": "^4.0.3", diff --git a/plugins/index.md b/plugins/index.md index f16abe5d..8172987a 100644 --- a/plugins/index.md +++ b/plugins/index.md @@ -24,12 +24,6 @@ Vite 旨在为常见的 web 开发工作提供开箱即用的支持。在搜索 - 提供对 Vue 2.7 JSX 对支持(通过 [dedicated Babel transform](https://github.com/vuejs/jsx-vue2/))。 -- Provides Vue 2.7 Single File Components support. - -### [@vitejs/plugin-vue2-jsx](https://github.com/vitejs/vite-plugin-vue2-jsx) - -- Provides Vue 2.7 JSX support (via [dedicated Babel transform](https://github.com/vuejs/jsx-vue2/)). - ### [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react) - 使用 esbuild 和 Babel,使用一个微小体积的包脚注可以实现极速的 HMR,同时提升灵活性,能够使用 Babel 的转换管线。在构建时没有使用额外的 Babel 插件,只使用了 esbuild。