Skip to content

Commit 72af4ae

Browse files
sync: Update Vite docs from upstream 20250522
1 parent c0cee3c commit 72af4ae

File tree

4 files changed

+19
-35
lines changed

4 files changed

+19
-35
lines changed

docs/guide/dep-pre-bundling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ If for some reason you want to force Vite to re-bundle deps, you can either star
8383

8484
Resolved dependency requests are strongly cached with HTTP headers `max-age=31536000,immutable` to improve page reload performance during dev. Once cached, these requests will never hit the dev server again. They are auto invalidated by the appended version query if a different version is installed (as reflected in your package manager lockfile). If you want to debug your dependencies by making local edits, you can:
8585

86-
1. Temporarily disable cache via the Network tab of your browser devtools;
87-
2. Restart Vite dev server with the `--force` flag to re-bundle the deps;
86+
1. Temporarily disable cache via the Network tab of your browser devtools.
87+
2. Restart Vite dev server with the `--force` flag to re-bundle the deps.
8888
3. Reload the page.

docs/guide/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Assets referenced by HTML elements such as `<script type="module" src>` and `<li
176176
- `<audio src>`
177177
- `<embed src>`
178178
- `<img src>` and `<img srcset>`
179-
- `<image src>`
179+
- `<image href>` and `<image xlink:href>`
180180
- `<input src>`
181181
- `<link href>` and `<link imagesrcset>`
182182
- `<object data>`

docs/guide/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The supported template presets are:
4444
## Scaffolding Your First Vite Project
4545

4646
::: tip Compatibility Note
47-
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.
47+
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.
4848
:::
4949

5050
::: code-group

docs/guide/troubleshooting.md

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,6 @@ See [Rollup's troubleshooting guide](https://rollupjs.org/troubleshooting/) for
44

55
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).
66

7-
## CJS
8-
9-
### Vite CJS Node API deprecated
10-
11-
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.
12-
13-
In a basic Vite project, make sure:
14-
15-
1. The `vite.config.js` file content is using the ESM syntax.
16-
2. The closest `package.json` file has `"type": "module"`, or use the `.mjs`/`.mts` extension, e.g. `vite.config.mjs` or `vite.config.mts`.
17-
18-
For other projects, there are a few general approaches:
19-
20-
- **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.
21-
- **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.
22-
- **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.
23-
24-
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:
25-
26-
```bash
27-
VITE_CJS_TRACE=true vite dev
28-
```
29-
30-
If you'd like to temporarily ignore the warning, you can run your script with the `VITE_CJS_IGNORE_WARNING=true` flag:
31-
32-
```bash
33-
VITE_CJS_IGNORE_WARNING=true vite dev
34-
```
35-
36-
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`.
37-
387
## CLI
398

409
### `Error: Cannot find module 'C:\foo\bar&baz\vite\bin\vite.js'`
@@ -245,3 +214,18 @@ An example of cross drive links are:
245214
- a symlink/junction to a different drive by `mklink` command (e.g. Yarn global cache)
246215

247216
Related issue: [#10802](https://github.com/vitejs/vite/issues/10802)
217+
218+
<script setup lang="ts">
219+
// redirect old links with hash to old version docs
220+
if (typeof window !== "undefined") {
221+
const hashForOldVersion = {
222+
'vite-cjs-node-api-deprecated': 6
223+
}
224+
225+
const version = hashForOldVersion[location.hash.slice(1)]
226+
if (version) {
227+
// update the scheme and the port as well so that it works in local preview (it is http and 4173 locally)
228+
location.href = `https://v${version}.vite.dev` + location.pathname + location.search + location.hash
229+
}
230+
}
231+
</script>

0 commit comments

Comments
 (0)