Integrates Babel transformation directly into Vite's dev server and build pipeline, allowing Babel plugins to run on all processed files during serve, build, and SSR. Version 1.6.0 supports Vite 2.7+ through 8 (inclusive) and requires @babel/core >=7.0.0. Unlike most Vite Babel integrations that only affect build, this plugin applies Babel across all Vite commands, making it useful for polyfills, code transforms, and custom syntax that Babel plugins provide. It's a thin wrapper that adds Babel as a Vite plugin, respecting Vite's cache and file-watching behavior.
npm install vite-plugin-babelVerified import paths — ran on the pinned version, not inferred.
Configures Vite with vite-plugin-babel, enabling Babel transforms for JavaScript/TypeScript files in src/ during dev and build.
Upgrade to Vite 2.7+ or pin to vite-plugin-babel@0.x.
Ensure files are included in Vite's module graph. Use filter/include/exclude options to control which files are transformed.
Add '@babel/plugin-transform-runtime' to babelConfig.plugins and install @babel/runtime.
Replace filter with include and exclude arrays of glob patterns or regexps.
Set esbuild.target to 'esnext' or disable esbuild's transform for .ts files.
Install: npm install @babel/core --save-dev
Use default import: import vitePluginBabel from 'vite-plugin-babel'
Replace filter with include/exclude in plugin options.