{"id":17505,"library":"babel-bits","title":"Babel Transform for bit-imports and bit-bundler","description":"babel-bits is an npm package designed to integrate Babel 6 transformations within the bit-imports and bit-bundler ecosystems. It acts as a handler for JavaScript files, allowing them to be transpiled during the import or bundling process. The package, currently at its last stable version v1.0.1 released in 2017, wraps `babel-core` (v6) along with `babel-preset-es2015` and `babel-preset-react` as default configurations. The project and its parent `bit-imports` and `bit-bundler` dependencies appear to be abandoned, with no significant updates or maintenance since 2017. Key differentiators included its deep integration with the specific module loading and bundling mechanisms of `bit-imports` and `bit-bundler`, offering a pre-configured, albeit outdated, Babel setup for those systems. It does not follow a regular release cadence and is effectively end-of-life.","status":"abandoned","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/MiguelCastillo/babel-bits","tags":["javascript","babel","bit-bundler","bit-imports"],"install":[{"cmd":"npm install babel-bits","lang":"bash","label":"npm"},{"cmd":"yarn add babel-bits","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-bits","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core Babel 6 transpiler.","package":"babel-core","optional":false},{"reason":"Default preset for ES2015 features.","package":"babel-preset-es2015","optional":false},{"reason":"Default preset for React JSX syntax.","package":"babel-preset-react","optional":false}],"imports":[{"note":"babel-bits is designed to be loaded by bit-imports as a handler string, not directly imported in user code via ES Modules or CommonJS `require()` statements.","wrong":"import { handler } from 'babel-bits'; /* Not exposed for direct import */","symbol":"babel-bits handler string","correct":"bitimports.plugin(\"js\", {\n  transform: {\n    handler: \"babel-bits\",\n    options: { /* ... */ }\n  }\n});"},{"note":"Babel options are passed directly through the `options` property within the `bit-imports` plugin configuration object.","wrong":"import { configure } from 'babel-bits';","symbol":"Options for Babel","correct":"bitimports.plugin(\"js\", {\n  transform: {\n    handler: \"babel-bits\",\n    options: {\n      sourceMaps: \"inline\",\n      presets: [\"es2015\", \"react\"]\n    }\n  }\n});"}],"quickstart":{"code":"const bitimports = require('bit-imports');\n\n// Configure bit-imports to use babel-bits for JavaScript transformations\nbitimports.plugin('js', {\n  transform: {\n    handler: 'babel-bits', // Specify babel-bits as the transformation handler\n    options: {\n      sourceMaps: 'inline', // Enable inline source maps for debugging\n      presets: ['es2015', 'react'] // Configure default Babel 6 presets\n    }\n  }\n});\n\n// Example of how bit-imports might then load a module\n// In a real application, you would load your main application file here\n// const myModule = bitimports.load('./src/main.js');\n// console.log('bit-imports configured with babel-bits:', myModule);\n\nconsole.log('babel-bits is configured via bit-imports plugin. No direct module interaction typically occurs.');\nconsole.log('Ensure babel-core, babel-preset-es2015, and babel-preset-react are installed alongside.');\n","lang":"javascript","description":"Demonstrates how to configure `babel-bits` as a transformation handler within `bit-imports`, enabling Babel 6 transpilation for loaded JavaScript files."},"warnings":[{"fix":"Downgrade your Babel setup to Babel 6 if you must use babel-bits, or migrate away from babel-bits and the bit-imports/bit-bundler ecosystem to a modern bundler like Webpack or Rollup with Babel 7+.","message":"babel-bits relies exclusively on Babel 6 (specifically `babel-core@^6.0.0`) and its associated presets. It is fundamentally incompatible with Babel 7+ due to significant API changes and package renames. Attempting to use it with a modern Babel setup will lead to errors.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Migrate your project to a currently maintained module bundler (e.g., Webpack, Rollup, Vite) and a modern Babel setup (Babel 7+).","message":"The entire babel-bits, bit-imports, and bit-bundler ecosystem is considered abandoned. There have been no code updates or maintenance since 2017. Using this package in new projects is strongly discouraged, and existing projects should plan for migration.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Load the `regenerator-runtime` package (e.g., `require('regenerator-runtime/runtime')` or include via a script tag) at the entry point of your application before any transpiled generator code executes.","message":"When using Babel 6 (as babel-bits does) for generator functions (e.g., `async/await`), you must manually include `regeneratorRuntime` in your application's global scope. Babel 6 does not automatically polyfill this, leading to runtime errors.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Ensure `babel-core`, `babel-preset-es2015`, and `babel-preset-react` (all `^6.0.0`) are installed as direct dependencies. Do NOT install `@babel/core` or other `@babel/` scoped packages.","cause":"babel-bits expects Babel 6 packages (e.g., `babel-core`), not Babel 7+ packages (e.g., `@babel/core`).","error":"Error: Cannot find module '@babel/core' or similar errors referencing new Babel packages."},{"fix":"Install `regenerator-runtime` (`npm install regenerator-runtime`) and import it once at the top of your application's entry file: `require('regenerator-runtime/runtime');` or ensure it's loaded via a script tag in the browser.","cause":"Babel 6 transforms generator functions (like `async/await`) into code that requires `regeneratorRuntime` to be available globally, but `babel-bits` does not automatically provide this polyfill.","error":"ReferenceError: regeneratorRuntime is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}