{"id":20490,"library":"rax-babel-config","title":"rax-babel-config","description":"Base Babel configuration for the Rax framework (cross-platform React-like UI). Version 2.0.4 is the latest stable release. This package provides a factory function that returns a Babel config object, with options to enable JSX stylesheet transforms, JSX+ plugins, JSX-to-HTML transforms, Node target preset-env, and Regenerator runtime control. It is part of the rax-scripts monorepo. Key differentiator: designed specifically for Rax projects, encapsulating the needed presets and plugins for optimal Rax development.","status":"active","version":"2.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/raxjs/rax-scripts","tags":["javascript"],"install":[{"cmd":"npm install rax-babel-config","lang":"bash","label":"npm"},{"cmd":"yarn add rax-babel-config","lang":"bash","label":"yarn"},{"cmd":"pnpm add rax-babel-config","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency of rax-babel-config; required for compiling Babel config","package":"@babel/core","optional":false}],"imports":[{"note":"Package does not ship ES modules; use CommonJS require. No default export.","wrong":"import { getBabelConfig } from 'rax-babel-config';","symbol":"getBabelConfig","correct":"const getBabelConfig = require('rax-babel-config');"},{"note":"This works only if using bundler with CJS interop (e.g., Babel's module transform). In Node ESM, use createRequire.","wrong":"import { getBabelConfig } from 'rax-babel-config';","symbol":"getBabelConfig","correct":"import getBabelConfig from 'rax-babel-config';"},{"note":"Destructuring works but function is the only export.","wrong":null,"symbol":"getBabelConfig","correct":"const { getBabelConfig } = require('rax-babel-config');"}],"quickstart":{"code":"const getBabelConfig = require('rax-babel-config');\n\nconst babelConfig = getBabelConfig({\n  styleSheet: true,\n  jsxPlus: false,\n  jsxToHtml: false,\n  isNode: false,\n  disableRegenerator: false\n});\n\nconsole.log(JSON.stringify(babelConfig, null, 2));","lang":"javascript","description":"Shows how to install and use rax-babel-config to generate a Babel config for a Rax project."},"warnings":[{"fix":"Update your postcss-loader configuration to match new options format; refer to changelog.","message":"Version 3.x of rax-scripts introduced breaking changes for postcss-loader options in rax-webpack-config and @builder/rax-pack.","severity":"breaking","affected_versions":">=3.8.16"},{"fix":"Replace rax-babel-config with @builder/rax-babel-config in package.json and update imports.","message":"rax-babel-config is a legacy package; consider migrating to the newer @builder/rax-babel-config.","severity":"deprecated","affected_versions":">=2.0.4"},{"fix":"Use require() or set up CJS interop.","message":"Package does not export as ES module; must use require() in Node.js CommonJS. Using import may fail depending on bundler/Node version.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Set styleSheet: false in options if not using inline styles.","message":"The 'styleSheet' option enables a plugin that transforms JSX style objects; if not needed, disable to avoid unnecessary transforms.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Install @babel/plugin-transform-react-jsx if jsxPlus is used incorrectly.","message":"The 'jsxPlus' option enables JSX+ syntax (e.g., loops, conditionals). Ensure your Babel runtime supports these extensions.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install rax-babel-config --save-dev'.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'rax-babel-config'"},{"fix":"Use dynamic import() or convert to CommonJS. Note: rax-babel-config itself is CJS, but if your project is ESM, use createRequire.","cause":"Trying to require a package that is defined as type: module in package.json.","error":"require() of ES Module not supported"},{"fix":"Use 'const getBabelConfig = require('rax-babel-config');' as default import.","cause":"Incorrect import style; package exports a function directly, not a named export.","error":"getBabelConfig is not a function"},{"fix":"Properly merge the returned config object with your base Babel configuration.","cause":"Babel config merging issue; getBabelConfig returns an object, but it may need to be spread into a full babel config.","error":"TypeError: Cannot read property 'presets' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}