From 50cd8ad2ee5dfc869255e6f138b53422c6d9c4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0?= Date: Wed, 21 May 2025 21:26:59 +0900 Subject: [PATCH 1/5] refactor!: bump required node version to 20.19+, 22.12+ and remove cjs build (#20032) --- guide/index.md | 2 +- guide/troubleshooting.md | 46 +++++++++++++--------------------------- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/guide/index.md b/guide/index.md index 4afc63cc..755a056a 100644 --- a/guide/index.md +++ b/guide/index.md @@ -44,7 +44,7 @@ The supported template presets are: ## Scaffolding Your First Vite Project ::: tip Compatibility Note -Vite requires [Node.js](https://nodejs.org/en/) version 20+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it. +Vite requires [Node.js](https://nodejs.org/en/) version 20.19+, 22.12+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it. ::: ::: code-group diff --git a/guide/troubleshooting.md b/guide/troubleshooting.md index c024a773..5f87310f 100644 --- a/guide/troubleshooting.md +++ b/guide/troubleshooting.md @@ -4,37 +4,6 @@ See [Rollup's troubleshooting guide](https://rollupjs.org/troubleshooting/) for If the suggestions here don't work, please try posting questions on [GitHub Discussions](https://github.com/vitejs/vite/discussions) or in the `#help` channel of [Vite Land Discord](https://chat.vite.dev). -## CJS - -### Vite CJS Node API deprecated - -The CJS build of Vite's Node API is deprecated and will be removed in Vite 6. See the [GitHub discussion](https://github.com/vitejs/vite/discussions/13928) for more context. You should update your files or frameworks to import the ESM build of Vite instead. - -In a basic Vite project, make sure: - -1. The `vite.config.js` file content is using the ESM syntax. -2. The closest `package.json` file has `"type": "module"`, or use the `.mjs`/`.mts` extension, e.g. `vite.config.mjs` or `vite.config.mts`. - -For other projects, there are a few general approaches: - -- **Configure ESM as default, opt-in to CJS if needed:** Add `"type": "module"` in the project `package.json`. All `*.js` files are now interpreted as ESM and need to use the ESM syntax. You can rename a file with the `.cjs` extension to keep using CJS instead. -- **Keep CJS as default, opt-in to ESM if needed:** If the project `package.json` does not have `"type": "module"`, all `*.js` files are interpreted as CJS. You can rename a file with the `.mjs` extension to use ESM instead. -- **Dynamically import Vite:** If you need to keep using CJS, you can dynamically import Vite using `import('vite')` instead. This requires your code to be written in an `async` context, but should still be manageable as Vite's API is mostly asynchronous. - -If you're unsure where the warning is coming from, you can run your script with the `VITE_CJS_TRACE=true` flag to log the stack trace: - -```bash -VITE_CJS_TRACE=true vite dev -``` - -If you'd like to temporarily ignore the warning, you can run your script with the `VITE_CJS_IGNORE_WARNING=true` flag: - -```bash -VITE_CJS_IGNORE_WARNING=true vite dev -``` - -Note that postcss config files do not support ESM + TypeScript (`.mts` or `.ts` in `"type": "module"`) yet. If you have postcss configs with `.ts` and added `"type": "module"` to package.json, you'll also need to rename the postcss config to use `.cts`. - ## CLI ### `Error: Cannot find module 'C:\foo\bar&baz\vite\bin\vite.js'` @@ -245,3 +214,18 @@ An example of cross drive links are: - a symlink/junction to a different drive by `mklink` command (e.g. Yarn global cache) Related issue: [#10802](https://github.com/vitejs/vite/issues/10802) + + From 948cb91f9582ac8b86a3fa285bf54c040aa2dc79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20P?= Date: Wed, 21 May 2025 16:15:18 +0200 Subject: [PATCH 2/5] docs: image svg element use href attribute (#20082) --- guide/features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/features.md b/guide/features.md index 86fc24f2..77e54099 100644 --- a/guide/features.md +++ b/guide/features.md @@ -176,7 +176,7 @@ Assets referenced by HTML elements such as ` ->>>>>>> c051c833e3340a8ea5a343bc1416600fdcfed087 From 3386b82115e406a8668a0a33a9a48972872fa85a Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Thu, 22 May 2025 10:14:15 +0800 Subject: [PATCH 5/5] docs: fix anchor --- guide/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/troubleshooting.md b/guide/troubleshooting.md index 73f9cda6..6e008f0d 100644 --- a/guide/troubleshooting.md +++ b/guide/troubleshooting.md @@ -4,7 +4,7 @@ 如果这里的建议并未帮助到你,请将你的问题发送到 [GitHub 讨论区](https://github.com/vitejs/vite/discussions) 或 [Vite Land Discord](https://chat.vite.dev) 的 `#help` 频道。 -## CLI +## CLI {#cli} ### `Error: Cannot find module 'C:\foo\bar&baz\vite\bin\vite.js'` {#error-cannot-find-module-cfoobarbazvitebinvitejs}