BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Vite 4 Released, Replaces Babel with Faster Rust-Based SWC

Vite 4 Released, Replaces Babel with Faster Rust-Based SWC

Bookmarks

The team behind the Vite frontend build tool recently released Vite 4.0, 5 months after Vite 3.0. The new version is motivated by the breaking upgrade from Rollup 2.0 to 3.0. Vite 4.0 also adds support for SWC, a Rust-based bundler that claims order-or-magnitude speed improvement over Babel.

Vite 4.0 now uses Rollup 3.0 at build time. Rollup 3.0 was announced a few weeks before at ViteConf 2022. ViteConf 2022 gathered the main participants in the Vite ecosystem. Since Vite 2.0, Vite is a framework-agnostic build tool. As a result, many other developer tools, libraries, and frameworks started supporting Vite — e.g., Storybook, Astro, Nuxt, SvelteKit, Solid Start, Hydrogen, Laravel, Qwik City, and more. The Vite team mentioned:

With the help of our ecosystem partners, [we are] happy to announce the release of Vite 4, powered during build time by Rollup 3. We’ve worked with the ecosystem to ensure a smooth upgrade path for this new major.

While Rollup 3 is mostly compatible with Rollup 2, developers who use custom rollupOptions may encounter issues and should refer to the Rollup migration guide to upgrade their config.

Vite 4.0 also upgrades the versions of dotenv and dotenv-expand (see the dotenv and dotenv-expand changelog). The new version of dotenv carries over breaking changes that will require developers to wrap names that contain certain characters (e.g., backtick) with quotes:

-VITE_APP=ab#cd`ef
+VITE_APP="ab#cd`ef"

The recent release of Next,JS 13 included Turbopack, a new, still-in-alpha, Rust-based replacement to Webpack that claimed to be orders of magnitude faster than Vite. Study of that claim associated most of the speed improvements to the use by Turbopack of SWC, a Rust-based bundler that is still in alpha. SWC claims to be 20x times faster than Babel, which was used in Vite 3.0. Vite 4.0 now adds support for SWC, which should help close the gap. The Vite team explains:

SWC is now a mature replacement for Babel, especially in the context of React projects. SWC’s React Fast Refresh implementation is a lot faster than Babel, and for some projects, it is now a better alternative. From Vite 4, two plugins are available for React projects with different tradeoffs. We believe that both approaches are worth supporting at this point, and we’ll continue to explore improvements to both plugins in the future.

Developers may refer to the migration guide and the release note for the exhaustive list of changes associated with the new version. Vite is distributed under the MIT open-source license. Contributions are welcome and must follow Vite’s contributing guide.

About the Author

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT