Skip to content

Commit f65d6ae

Browse files
authored
docs(migration): add section for html asset sources (#18536)
1 parent 8a7af50 commit f65d6ae

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/guide/features.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Any HTML files in your project root can be directly accessed by its respective d
170170
- `<root>/about.html` -> `http://localhost:5173/about.html`
171171
- `<root>/blog/index.html` -> `http://localhost:5173/blog/index.html`
172172

173-
Files referenced by HTML elements such as `<script type="module">` and `<link href>` are processed and bundled as part of the app. General asset elements can also reference assets to be optimized by default, including:
173+
Assets referenced by HTML elements such as `<script type="module" src>` and `<link href>` are processed and bundled as part of the app. The full list of supported elements are as below:
174174

175175
- `<audio src>`
176176
- `<embed src>`
@@ -179,6 +179,7 @@ Files referenced by HTML elements such as `<script type="module">` and `<link hr
179179
- `<input src>`
180180
- `<link href>` and `<link imagesrcet>`
181181
- `<object data>`
182+
- `<script type="module" src>`
182183
- `<source src>` and `<source srcset>`
183184
- `<track src>`
184185
- `<use href>` and `<use xlink:href>`

docs/guide/migration.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ From Vite 6, even when `json.stringify: true` is set, `json.namedExports` is not
2020

2121
Vite 6 also introduces a new default value for `json.stringify` which is `'auto'`, which will only stringify large JSON files. To disable this behavior, set `json.stringify: false`.
2222

23+
### Extended support of asset references in HTML elements
24+
25+
In Vite 5, only a few supported HTML elements were able to reference assets that will be processed and bundled by Vite, such as `<link href>`, `<img src>`, etc.
26+
27+
Vite 6 extends the support to even more HTML elements. The full list can be found at the [HTML features](/guide/features.html#html) docs.
28+
29+
To opt-out of HTML processing on certain elements, you can add the `vite-ignore` attribute on the element.
30+
2331
### postcss-load-config
2432

2533
[`postcss-load-config`](https://npmjs.com/package/postcss-load-config) has been updated to v6 from v4. [`tsx`](https://www.npmjs.com/package/tsx) or [`jiti`](https://www.npmjs.com/package/jiti) is now required to load TypeScript postcss config files instead of [`ts-node`](https://www.npmjs.com/package/ts-node). Also [`yaml`](https://www.npmjs.com/package/yaml) is now required to load YAML postcss config files.

0 commit comments

Comments
 (0)