Skip to content

Migration from v5

Environment API

As part of the new experimental Environment API, a big internal refactoring was needed. Vite 6 strives to avoid breaking changes to ensure most projects can quickly upgrade to the new major. We'll wait until a big portion of the ecosystem has moved to stabilize and start recommending the use of the new APIs. There may be some edge cases but these should only affect low level usage by frameworks and tools. We have worked with maintainers in the ecosystem to mitigate these differences before the release. Please open an issue if you spot a regression.

Some internal APIs have been removed due to changes in Vite's implementation. If you were relying on one of them, please create a feature request.

Vite Runtime API

The experimental Vite Runtime API evolved into the Module Runner API, released in Vite 6 as part of the new experimental Environment API. Given that the feature was experimental the removal of the previous API introduced in Vite 5.1 isn't a breaking change, but users will need to update their use to the Module Runner equivalent as part of migrating to Vite 6.

General Changes

JSON stringify

In Vite 5, when json.stringify: true is set, json.namedExports was disabled.

From Vite 6, even when json.stringify: true is set, json.namedExports is not disabled and the value is respected. If you wish to achieve the previous behavior, you can set json.namedExports: false.

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.

Sass now uses modern API by default

In Vite 5, the legacy API was used by default for Sass. Vite 5.4 added support for the modern API.

From Vite 6, the modern API is used by default for Sass. If you wish to still use the legacy API, you can set css.preprocessorOptions.sass.api: 'legacy' / css.preprocessorOptions.scss.api: 'legacy'. But note that the legacy API support will be removed in Vite 7.

To migrate to the modern API, see the Sass documentation.

Advanced

There are other breaking changes which only affect few users.

Migration from v4

Check the Migration from v4 Guide in the Vite v5 docs first to see the needed changes to port your app to Vite 5, and then proceed with the changes on this page.

ត្រូវបានចេញផ្សាយដោយស្ថិតក្រោមអញ្ញាប័ណ្ណ MIT ។ (dev)