{"_id":"@cabloy/vite-plugin-babel","_rev":"3-1674eb1f282ae5b27c0987ee4eec5936","name":"@cabloy/vite-plugin-babel","dist-tags":{"latest":"1.3.3"},"versions":{"1.1.3":{"name":"@cabloy/vite-plugin-babel","version":"1.1.3","keywords":["vite-plugin","vite","babel"],"author":{"name":"Miłosz Mandowski"},"license":"MIT","_id":"@cabloy/vite-plugin-babel@1.1.3","maintainers":[{"name":"zhennann","email":"zhen.nann@icloud.com"}],"homepage":"https://github.com/owlsdepartment/vite-plugin-babel#readme","bugs":{"url":"https://github.com/owlsdepartment/vite-plugin-babel/issues"},"dist":{"shasum":"b2c94705faf65ceaeb6190c180ed9f829e7b049b","tarball":"https://registry.npmjs.org/@cabloy/vite-plugin-babel/-/vite-plugin-babel-1.1.3.tgz","fileCount":12,"integrity":"sha512-OW9J2q9ze0hLvBQOPwjzX/CPMs3PszDc6rbJP6BgNFfdLkoebkWkkZuCB03CCOl35kOdPIRKs/tjxQDxd6WSzw==","signatures":[{"sig":"MEUCIBJwlElR7NEDqpsQ81h6488txavompd8E9ra0rpi1hakAiEAoUFz9IJhztMBW4dZhzPZ7EZElffnT9SbYd8hoHKOQlE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53521},"type":"module","_from":"file:cabloy-vite-plugin-babel-1.1.3.tgz","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"clean":"rm -rf dist"},"_npmUser":{"name":"zhennann","email":"zhen.nann@icloud.com"},"_resolved":"/private/var/folders/bc/175zy6hs3q54x38sldpqhl8c0000gn/T/7c419c2c7f492ebd223f2a7c33073aaa/cabloy-vite-plugin-babel-1.1.3.tgz","_integrity":"sha512-OW9J2q9ze0hLvBQOPwjzX/CPMs3PszDc6rbJP6BgNFfdLkoebkWkkZuCB03CCOl35kOdPIRKs/tjxQDxd6WSzw==","repository":{"url":"git+https://github.com/owlsdepartment/vite-plugin-babel.git","type":"git"},"_npmVersion":"10.2.3","description":"Runs Babel in Vite during all commands","directories":{},"_nodeVersion":"20.10.0","dependencies":{"esbuild":"^0.20.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.0.8","tslib":"^2.6.2","typescript":"^5.3.3","@babel/core":"^7.23.6","@types/node":"^20.10.4","@types/babel__core":"^7.20.5"},"peerDependencies":{"vite":"^2.7.0 || ^3.0.0 || ^4.0.0 || ^5.0.0","@babel/core":"^7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-babel_1.1.3_1711793466408_0.9798720857468262","host":"s3://npm-registry-packages"}},"1.3.1":{"name":"@cabloy/vite-plugin-babel","version":"1.3.1","keywords":["vite-plugin","vite","babel"],"author":{"name":"Miłosz Mandowski"},"license":"MIT","_id":"@cabloy/vite-plugin-babel@1.3.1","maintainers":[{"name":"zhennann","email":"zhen.nann@icloud.com"}],"homepage":"https://github.com/owlsdepartment/vite-plugin-babel#readme","bugs":{"url":"https://github.com/owlsdepartment/vite-plugin-babel/issues"},"dist":{"shasum":"46c5cce0f59a1f14ff9e1f7b74da36172b4cf493","tarball":"https://registry.npmjs.org/@cabloy/vite-plugin-babel/-/vite-plugin-babel-1.3.1.tgz","fileCount":15,"integrity":"sha512-bzUIP318dMSGJzMqtAU9ut/xCYgBNMQV12UKPQZ1tM29XUMnmU2uBTFAZ+9JX3XNggQgkf/x9mKDPPEVrRteMA==","signatures":[{"sig":"MEQCIFqGOFe1Ko62OsUQbrTx6W6kMp7glFGhySMxaT0dp7DyAiBiHVlkqZ3dyp0h/I6bUX0LiVV6belarN7W9DaDnLpDFQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16112},"type":"module","_from":"file:cabloy-vite-plugin-babel-1.3.1.tgz","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"clean":"rm -rf dist"},"_npmUser":{"name":"zhennann","email":"zhen.nann@icloud.com"},"_resolved":"/private/var/folders/qy/ds95fdx91vz7rplzrblbdxnr0000gn/T/a926703a40f578714858a9c84846a55e/cabloy-vite-plugin-babel-1.3.1.tgz","_integrity":"sha512-bzUIP318dMSGJzMqtAU9ut/xCYgBNMQV12UKPQZ1tM29XUMnmU2uBTFAZ+9JX3XNggQgkf/x9mKDPPEVrRteMA==","repository":{"url":"git+https://github.com/owlsdepartment/vite-plugin-babel.git","type":"git"},"_npmVersion":"11.2.0","description":"Runs Babel in Vite during all commands","directories":{},"_nodeVersion":"23.9.0","dependencies":{"esbuild":"^0.20.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.0.0","tslib":"^2.6.2","typescript":"^5.3.3","@babel/core":"^7.23.6","@types/node":"^20.10.4","@types/babel__core":"^7.20.5"},"peerDependencies":{"vite":"^2.7.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0","@babel/core":"^7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-babel_1.3.1_1746517411560_0.8275148768908773","host":"s3://npm-registry-packages-npm-production"}},"1.3.3":{"name":"@cabloy/vite-plugin-babel","version":"1.3.3","description":"Runs Babel in Vite during all commands","keywords":["babel","vite","vite-plugin"],"homepage":"https://github.com/owlsdepartment/vite-plugin-babel#readme","bugs":{"url":"https://github.com/owlsdepartment/vite-plugin-babel/issues"},"license":"MIT","author":{"name":"Miłosz Mandowski"},"repository":{"type":"git","url":"git+https://github.com/owlsdepartment/vite-plugin-babel.git"},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"publishConfig":{"access":"public"},"dependencies":{"esbuild":"^0.20.1"},"devDependencies":{"@babel/core":"^7.23.6","@types/babel__core":"^7.20.5","@types/node":"^20.10.4","tslib":"^2.6.2","typescript":"^5.3.3","vite":"^8.0.0"},"peerDependencies":{"@babel/core":"^7.29.0","vite":"^2.7.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"},"scripts":{"clean":"rm -rf dist"},"_id":"@cabloy/vite-plugin-babel@1.3.3","_integrity":"sha512-fr4XlCREJDFi0bg3rXpm1jmvGN2M7WHGG4vCzpLmXGMzrM3X68Bk/gem16NoVSBteKH/ybm4CaNFIOy6Gqu8cg==","_resolved":"/private/var/folders/qy/ds95fdx91vz7rplzrblbdxnr0000gn/T/edc93e1bb53e286f4e7874b7fd817982/cabloy-vite-plugin-babel-1.3.3.tgz","_from":"file:cabloy-vite-plugin-babel-1.3.3.tgz","_nodeVersion":"24.8.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-fr4XlCREJDFi0bg3rXpm1jmvGN2M7WHGG4vCzpLmXGMzrM3X68Bk/gem16NoVSBteKH/ybm4CaNFIOy6Gqu8cg==","shasum":"dc78a382047078900015f9bdc59fa2855665bb5a","tarball":"https://registry.npmjs.org/@cabloy/vite-plugin-babel/-/vite-plugin-babel-1.3.3.tgz","fileCount":15,"unpackedSize":16090,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCQ7NUGJDqTyDe0fItP6jopgA6ZmikV+feJDHEoSiBDNAIhAMk2TMF40xI8oucQpUNgXO1wpDlvJ789QVweLv8jN1nZ"}]},"_npmUser":{"name":"zhennann","email":"zhen.nann@icloud.com"},"directories":{},"maintainers":[{"name":"zhennann","email":"zhen.nann@icloud.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vite-plugin-babel_1.3.3_1774186340023_0.9425927046531177"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-30T10:11:06.345Z","modified":"2026-03-22T13:32:20.281Z","1.1.3":"2024-03-30T10:11:06.596Z","1.3.1":"2025-05-06T07:43:31.756Z","1.3.3":"2026-03-22T13:32:20.163Z"},"bugs":{"url":"https://github.com/owlsdepartment/vite-plugin-babel/issues"},"author":{"name":"Miłosz Mandowski"},"license":"MIT","homepage":"https://github.com/owlsdepartment/vite-plugin-babel#readme","keywords":["babel","vite","vite-plugin"],"repository":{"type":"git","url":"git+https://github.com/owlsdepartment/vite-plugin-babel.git"},"description":"Runs Babel in Vite during all commands","maintainers":[{"name":"zhennann","email":"zhen.nann@icloud.com"}],"readme":"# Vite Plugin Babel\n\nRun Babel during any Vite command, also during serve.\n\n## Motivations\n\nMost Vite plugins runs Babel only during `build`, not `serve`, and only other possible way to do this is via [@vitejs/plugin-react](https://www.npmjs.com/package/@vitejs/plugin-react). ESBuild is awesome tool, but doesn't support some experimental features, like decorators ([issue #2349](https://github.com/vitejs/vite/issues/2349)) or class instance fields, out of box. You can use them in TypeScript, but not pure JS. This plugin was made to enable usage of such features and runs babel during `optimizeDeps`, `dev` and `build` stages, but it can be configured.\n\n## Installation\n\n```bash\n# yarn\nyarn add -D vite-plugin-babel\n\n# npm\nnpm install -D vite-plugin-babel\n```\n\n## Usage\n\nAdd it to your Vite config\n\n```js\nimport { defineConfig } from 'vite';\nimport babel from 'vite-plugin-babel';\n\nexport default defineConfig({\n    plugins: [\n        // Babel will try to pick up Babel config files (.babelrc or .babelrc.json)\n        babel(),\n        // ...\n    ],\n\n    // ...\n})\n```\n\n## Config\n\nBabel config can be either passed to `babelConfig` field or via Babel config file. For all babel options see: [Babel Options](https://babeljs.io/docs/en/options).\n\nBy default, babel is run for JS/JSX files. You can change that vie `filter` option.\n\n| Name | Type | Default | Description |\n|---|---|---|---|\n| `apply` | `'serve' \\| 'build' \\| (config: UserConfig, env: ConfigEnv) => boolean` | `undefined` | Limits plugin usage to only build or only serve. If not specified, will be run during both cycles. Same as [`apply` in Vite Plugins API](https://vite.dev/guide/api-plugin.html#conditional-application) |\n| `enforce` | `'pre' \\| 'post'` | `pre` | Force plugin's order execution. More details: [Vite Plugin Ordering](https://vite.dev/guide/api-plugin.html#plugin-ordering) |\n| `babelConfig` | `object` | `{}` | [Babel Transform Options](https://babeljs.io/docs/en/options) |\n| `filter` | `RegExp \\| (id: string) => boolean` | `/\\.jsx?$/` | Which files is babel applied to. By default, it's js/jsx files. You can pass a filter function that accepts file name and returns `true \\| false` |\n| `include` | `string \\| RegExp \\| Array<string\\|RegExp>)` | `undefined` | which files to include. If omitted, all are included |\n| `exclude` | `string \\| RegExp \\| Array<string\\|RegExp>)` | `undefined` | which files to exclude. If used with `include`, it will have higher priority and can exclude files, that match `include` pattern |\n| `loader` | `Loader` or `(path: string) => Loader` | `undefined` | This tells esbuild how to interpret the contents after babel's transformation. For example, the js loader interprets the contents as JavaScript and the css loader interprets the contents as CSS. The loader defaults to js if it's not specified. See the [Content Types](https://esbuild.github.io/content-types) page for a complete list of all built-in loaders. |\n\n## Tips\n\nVite team didn't enable and include Babel by default, because they wanted to keep experience as fast as possible and esbuild can already do a lot of things, you would probably do with Babel. Because of that, we recommend to only include those Babel plugins you really need. You can use option `babelConfig.configFile` and disable usage of Babel config file, ex.:\n\n```js\nbabel({\n    babelConfig: {\n        babelrc: false,\n        configFile: false,\n        plugins: ['@babel/plugin-proposal-decorators']\n    }\n})\n```\n\nor just use `.babelrc.json`.\n\n__NOTE:__ Any babel plugins and presets need to be installed seperately and are not included with this package.\n\n## Troubleshooting\n\n#### [ERROR] The JSX syntax extension is not currently enabled\n\nThis usually happens when you're using this plugin to only transform part of a `.jsx` file (such as decorators), and leaving the JSX syntax untouched. By default, esbuild interprets contents as `.js`, so you'll need to specify the loader esbuild should use.\n\nExample:\n\n```js\nimport { extname } from 'path';\n// ...\nbabel({\n    babelConfig: {\n        babelrc: false,\n        configFile: false,\n        plugins: ['@babel/plugin-proposal-decorators'],\n        \n        // uses the jsx loader for .jsx files\n        loader: path => {\n          if (extname(path) === '.jsx') {\n            return 'jsx';\n          }\n        },\n    }\n})\n```\n\n## License\n\nLibrary is under [MIT License](LICENSE)\n","readmeFilename":"README.md"}