{"id":42222,"library":"vite-plugin-babel-compiler","title":"Vite Plugin Babel Compiler","description":"A Vite plugin that replaces esbuild transpilation with Babel for files matching include/exclude patterns. Version 0.4.1 is the latest stable release; the plugin is actively maintained with infrequent updates. It enables experimental JavaScript features (e.g., decorators, class properties) that esbuild does not support, providing fine-grained control via Babel configurations. Unlike alternative plugins like @mdx-js/rollup or manual esbuild configure, this plugin integrates seamlessly with Vite's build pipeline and supports both development and production builds. Requires @babel/core as a peer dependency and Vite >=2.0.0.","status":"active","version":"0.4.1","language":"javascript","source_language":"en","source_url":"https://github.com/yzydeveloper/vite-plugin-babel-compiler","tags":["javascript","vite","esbuild","typescript"],"install":[{"cmd":"npm install vite-plugin-babel-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-babel-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-babel-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency for Babel compilation","package":"@babel/core","optional":false},{"reason":"Peer dependency; plugin designed for Vite >=2.0.0","package":"vite","optional":false}],"imports":[{"note":"ESM-only; default export is the plugin factory function.","wrong":"const babel = require('vite-plugin-babel-compiler')","symbol":"default","correct":"import babel from 'vite-plugin-babel-compiler'"},{"note":"Named export also available as 'babel' but default is preferred.","wrong":"import { Babel } from 'vite-plugin-babel-compiler'","symbol":"babel (named)","correct":"import { babel } from 'vite-plugin-babel-compiler'"},{"note":"Plugin types are from Vite, not this package.","wrong":"","symbol":"type Plugin","correct":"import type { Plugin } from 'vite'"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport babel from 'vite-plugin-babel-compiler';\n\nexport default defineConfig({\n  plugins: [\n    babel({\n      babel: {\n        plugins: [\n          ['@babel/plugin-proposal-decorators', { legacy: true }],\n          ['@babel/plugin-proposal-class-properties', { loose: true }]\n        ]\n      }\n    })\n  ]\n});","lang":"typescript","description":"Configures Vite to use Babel compiler with decorator and class property plugins."},"warnings":[{"fix":"Use vite-plugin-babel-compiler@latest or check compatibility; consider using @vitejs/plugin-babel if available.","message":"Vite 5 dropped support for some plugin hooks; this plugin may not work with Vite 5+.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Wrap all Babel options under `babel` key. See README.","message":"The `babel` option shape changed in v0.3.0; older configs with top-level options fail silently.","severity":"deprecated","affected_versions":">=0.3.0"},{"fix":"Ensure `include` and `exclude` are arrays. e.g., `include: ['src/**/*.tsx']`","message":"Include/exclude patterns must be arrays of strings or RegExp; misconfiguration causes all files to be transpiled by esbuild.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use conditionals: `plugins: [process.env.NODE_ENV === 'development' ? babel({...}) : null]`","message":"Running both dev and build modes: plugin applies to both; avoid double Babel compilation if another plugin also transforms.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'/rollup':63 '0.4.1':20 '2.0.0':92 'activ':29 'altern':57 'babel':3,13,54 'babel/core':85 'build':75,83 'class':41 'compil':4 'configur':55,67 'control':52 'decor':40 'depend':89 'develop':80 'e.g':39 'enabl':35 'esbuild':10,44,66,95 'experiment':36 'featur':38 'file':15 'fine':50 'fine-grain':49 'grain':51 'include/exclude':17 'infrequ':32 'integr':70 'javascript':37,93 'js':62 'latest':23 'like':59 'maintain':30 'manual':65 'match':16 'mdx':61 'mdx-js':60 'pattern':18 'peer':88 'pipelin':76 'plugin':2,7,27,58,69 'product':82 'properti':42 'provid':48 'releas':25 'replac':9 'requir':84 'seamless':71 'stabl':24 'support':47,78 'transpil':11 'typescript':96 'unlik':56 'updat':33 'version':19 'via':53 'vite':1,6,73,91,94","created_at":"2026-06-04T18:56:12.934691+00:00","updated_at":"2026-06-04T18:56:12.934691+00:00","problems":[{"fix":"npm install -D @babel/core","cause":"Missing @babel/core package.","error":"Error: Plugin babel-compiler: Must provide @babel/core as a peer dependency."},{"fix":"import babel from 'vite-plugin-babel-compiler' (default) or import { babel } from '...'","cause":"Importing default export incorrectly; using named export 'babel' but expecting function.","error":"TypeError: babel is not a function"},{"fix":"npm install -D vite-plugin-babel-compiler","cause":"Package not installed or Vite resolving incorrectly.","error":"Error: Could not resolve 'vite-plugin-babel-compiler'"},{"fix":"Check that the file path matches `include` patterns and is not in `exclude`.","cause":"Plugin not configured or include/exclude patterns exclude the file.","error":"SyntaxError: Invalid or unexpected token (if Babel not applied)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/yzydeveloper/vite-plugin-babel-compiler","github":"https://github.com/yzydeveloper/vite-plugin-babel-compiler","docs":null,"changelog":null,"pypi":null,"npm":"vite-plugin-babel-compiler","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}