{"id":19333,"library":"babel-preset-remax","title":"babel-preset-remax","description":"Babel preset for Remax, a framework for building mini-programs using React. Current stable version is 2.15.14, with regular releases on GitHub. This preset configures @babel/preset-react, @babel/preset-typescript, and plugins for decorators and class properties, tailored for Remax apps. It differs from generic React presets by providing options to control React runtime, TypeScript namespace support, and legacy decorator syntax, ensuring compatibility with mini-program environments.","status":"active","version":"2.15.14","language":"javascript","source_language":"en","source_url":"https://github.com/remaxjs/remax","tags":["javascript","typescript"],"install":[{"cmd":"npm install babel-preset-remax","lang":"bash","label":"npm"},{"cmd":"yarn add babel-preset-remax","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-preset-remax","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for all Babel presets","package":"@babel/core","optional":false}],"imports":[{"note":"The preset is exported as a CommonJS module; used in .babelrc or babel.config.js via presets array.","symbol":"default","correct":"module.exports = require('babel-preset-remax')"},{"note":"Babel resolves 'remax' to the preset package; full name is optional but works.","wrong":"presets: ['babel-preset-remax']","symbol":"remax","correct":"presets: ['remax']"},{"note":"TypeScript types are shipped; import for type checking: import type { RemaxPresetOptions } from 'babel-preset-remax';","symbol":"Options","correct":"interface RemaxPresetOptions { react?: object; typescript?: object; decorators?: object; 'class-properties'?: object; 'throw-if-namespace'?: boolean; }"}],"quickstart":{"code":"// babel.config.js\nmodule.exports = {\n  presets: [\n    ['remax', {\n      react: { runtime: 'automatic' },\n      typescript: { allowNamespaces: true },\n      'class-properties': { loose: true },\n      'throw-if-namespace': false\n    }]\n  ]\n};","lang":"javascript","description":"Configuration for Remax Babel preset with React automatic runtime, TypeScript namespace support, loose class properties, and disabled throw-if-namespace."},"warnings":[{"fix":"Remove 'throw-if-namespace' and set 'react.runtime' to 'automatic'.","message":"The 'throw-if-namespace' option is deprecated in recent React presets; use 'runtime: 'automatic'' instead.","severity":"deprecated","affected_versions":">=2.15.0"},{"fix":"Set 'class-properties.loose' to false if strict spec compliance is needed.","message":"Class properties loose mode may affect compatibility with older mini-program runtimes; test thoroughly.","severity":"gotcha","affected_versions":"all"},{"fix":"Set both 'decorators.legacy: true' and 'class-properties.loose: true'.","message":"Enabling 'decorators.legacy' requires 'class-properties.loose' to be true for correct ordering.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade @babel/core to >=7.0.0.","message":"Babel 7.0+ is required; older versions will fail with 'Cannot find module'.","severity":"breaking","affected_versions":"<7.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use 'throw-if-namespace' as a string key in object: { 'throw-if-namespace': false }.","cause":"Invalid option name; correct key is 'throw-if-namespace' (with quotes) in Babel config.","error":"Error: [BABEL] unknown option: .throw-if-namespace"},{"fix":"Add 'decorators: { legacy: true }' to preset options.","cause":"Decorator plugin not loaded or misconfigured, often due to missing 'decorators.legacy' option.","error":"TypeError: Cannot read property 'call' of undefined"},{"fix":"Install with `npm install --save-dev babel-preset-remax` and use 'remax' as preset name.","cause":"Package not installed or incorrect import path in Babel config.","error":"Module not found: Can't resolve 'babel-preset-remax'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}