{"id":19093,"library":"babel-plugin-jsx-property-alias","title":"babel-plugin-jsx-property-alias","description":"Babel plugin for aliasing JSX properties, primarily used to map testID to accessibilityLabel for React Native Appium testing. Current stable version is 2.0.0 (2018). Low release cadence; primarily a utility for QA builds. Key differentiator: it solves a specific React Native + Appium incompatibility without polluting production code, and supports environment whitelisting via ALIAS_ENVIRONMENT variable. Alternatives: manual testID duplication, but this plugin automates the transform.","status":"maintenance","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/jribeiro/babel-plugin-jsx-property-alias","tags":["javascript","babel","babel-plugin","react","jsx","alias","apium","react-native","properties"],"install":[{"cmd":"npm install babel-plugin-jsx-property-alias","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-jsx-property-alias","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-jsx-property-alias","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for Babel plugin API","package":"@babel/core","optional":true}],"imports":[{"note":"Plugin must be configured with options in a nested array. Options are required: at least 'properties' key.","wrong":"// Incorrect: using plugin without array notation\n{\n  \"plugins\": [\"jsx-property-alias\"]\n}","symbol":"default","correct":"// In .babelrc or babel.config.js:\n{\n  \"plugins\": [\n    [\"jsx-property-alias\", { \"properties\": { \"testID\": \"accessibilityLabel\" } }]\n  ]\n}"},{"note":"This package is CJS-only; use require() in Node.js. There is no default export.","wrong":"import plugin from 'babel-plugin-jsx-property-alias'; // ESM not supported in commonjs babel configs","symbol":"require","correct":"const plugin = require('babel-plugin-jsx-property-alias');"},{"note":"Plugin uses process.env.BABEL_ENV by default to decide whether to transform. Overridable via includeInEnvironments option and ALIAS_ENVIRONMENT variable.","wrong":"NODE_ENV=appium babel src --out-dir build // Plugin relies on BABEL_ENV, not NODE_ENV","symbol":"BABEL_ENV","correct":"BABEL_ENV=appium babel src --out-dir build"}],"quickstart":{"code":"// Install: npm install --save-dev babel-plugin-jsx-property-alias\n\n// .babelrc\n{\n  \"env\": {\n    \"appium\": {\n      \"plugins\": [\n        [\"jsx-property-alias\", {\n          \"properties\": {\n            \"testID\": \"accessibilityLabel\"\n          }\n        }]\n      ]\n    }\n  }\n}\n\n// Then run:\nBABEL_ENV=appium babel src --out-dir build\n\n// Input: <View testID=\"my_button\" />\n// Output: <View testID=\"my_button\" accessibilityLabel=\"my_button\" />","lang":"javascript","description":"Configures Babel to replace testID with accessibilityLabel when BABEL_ENV is set to 'appium'."},"warnings":[{"fix":"Use the new 'properties' object instead of 'from'/'to' arrays. See README for v2 API.","message":"Version 2 changed options format. Old v1 option names and structure no longer work.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure that components do not have both testID and accessibilityLabel set manually, or accept that testID will overwrite.","message":"Plugin replaces existing accessibilityLabel if present; no merging.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set ALIAS_ENVIRONMENT to 'appium' (or your custom env name) in your React Native build scripts.","message":"React Native does not respect BABEL_ENV by default; you must use ALIAS_ENVIRONMENT env var or the includeInEnvironments option.","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 --save-dev babel-plugin-jsx-property-alias'","cause":"Plugin not installed or not in node_modules.","error":"Error: Cannot find module 'babel-plugin-jsx-property-alias'"},{"fix":"Use array syntax: [\"jsx-property-alias\", { \"properties\": { ... } }]","cause":"Missing options object when adding plugin to Babel config.","error":"TypeError: Cannot read property 'properties' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}