Skip to content
  1. Blog

Roots Vite Plugin Adds Vite v8 Support

Ben Word Ben Word

@roots/vite-plugin v2 updates our Vite plugin for WordPress for Vite v8, which replaces both Rollup and esbuild with Rolldown — a Rust-based bundler built specifically for Vite.

Build performance

ProjectVite 7Vite 8Improvement
Sage82ms74ms9.8% faster
Radicle232ms105ms54.7% faster

The gains scale with project complexity. Larger projects see the biggest improvements.

Upgrading

Requires vite ^8.0.0, laravel-vite-plugin ^3.0.0.

In vite.config.js, move import.meta.glob asset patterns to the assets option on laravel-vite-plugin:

laravel({
       input: [
         'resources/css/app.css',
         'resources/js/app.js',
         'resources/css/editor.css',
         'resources/js/editor.js',
       ],
       refresh: true,
+      assets: ['resources/images/**', 'resources/fonts/**'],
     }),

In resources/js/app.js, remove the import.meta.glob call:

-import.meta.glob([
-  '../images/**',
-  '../fonts/**',
-]);

Both Sage and Radicle have been updated with the latest version of @roots/vite-plugin and the changes above.

Discuss this post on Roots Discourse

About the author

Ben Word

Ben Word has been creating WordPress sites since 2004. He loves dogs, climbing, and yoga, and is passionate about helping people build awesome things on the web.

Subscribe for updates

Join over 8,000 subscribers for the latest Roots updates, WordPress plugin recommendations, modern WordPress projects, and web development tips.

One last step! Check your email for a verification link.