{"id":19208,"library":"babel-plugin-transform-proxy-compat","title":"babel-plugin-transform-proxy-compat","description":"Babel plugin that rewrites property lookups, assignments, deletions, function invocations, 'in' statements, and 'for...in' loops to use function calls from a proxy-compat library, enabling Proxy semantics in environments like IE 11 that lack native Proxy support. Current stable version is 0.22.4, with maintenance-level releases. Key differentiator: allows using modern Proxy-based reactivity or interceptors while targeting legacy browsers without polyfilling Proxy itself. Typically paired with libraries like `proxy-compat` that provide the runtime helper functions.","status":"maintenance","version":"0.22.4","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install babel-plugin-transform-proxy-compat","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-transform-proxy-compat","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-transform-proxy-compat","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime module that provides the actual proxy-compat functions (callKey, getKey, setKey, etc.) when using module or independent modes.","package":"proxy-compat","optional":false}],"imports":[{"note":"CommonJS require works; this plugin is not ESM-only.","wrong":"const plugin = require('babel-plugin-transform-proxy-compat');","symbol":"babel-plugin-transform-proxy-compat","correct":"import plugin from 'babel-plugin-transform-proxy-compat';"},{"note":"callKey is a named export from proxy-compat; default export is the whole module.","wrong":"import callKey from 'proxy-compat';","symbol":"callKey","correct":"import { callKey } from 'proxy-compat';"},{"note":"CommonJS users should use const ProxyCompat = require('proxy-compat'); (no .default)","wrong":"const ProxyCompat = require('proxy-compat').default;","symbol":"ProxyCompat","correct":"import ProxyCompat from 'proxy-compat';"}],"quickstart":{"code":"// babel.config.js\nmodule.exports = {\n  plugins: [\n    ['babel-plugin-transform-proxy-compat', {\n      resolveProxyCompat: {\n        module: 'proxy-compat'\n      }\n    }]\n  ]\n};\n\n// source.js\nconst obj = new Proxy({}, {\n  get(target, prop) {\n    return prop in target ? target[prop] : 42;\n  }\n});\nconsole.log(obj.foo); // becomes: console.log(callKey(obj, 'foo'));\n","lang":"javascript","description":"Configures Babel to transform Proxy operations to use proxy-compat runtime for IE 11 compatibility."},"warnings":[{"fix":"Use /* proxy-compat-disable */ comment at top of files that are performance-sensitive and do not use Proxy.","message":"Plugin rewrites ALL object property access, assignment, deletion, and 'in'/'for...in' expressions, even if not related to a Proxy. This can cause significant code bloat and performance degradation.","severity":"gotcha","affected_versions":"*"},{"fix":"Update config to use { module: '...' } or { global: '...' } instead of just a string.","message":"Option 'resolveProxyCompat' changed from accepting a string to an object with module/global/independent properties (v0.16+).","severity":"breaking","affected_versions":">=0.16 <0.22"},{"fix":"Use resolveProxyCompat with module or global sub-option.","message":"The 'polyfill' option was removed in favor of 'resolveProxyCompat' (v0.10+).","severity":"deprecated","affected_versions":">=0.10 <0.16"},{"fix":"Ensure a global variable (e.g., window.MyProxyCompat) is defined via a script tag or other means.","message":"When using 'global' mode, the global variable must be defined before the transformed code runs. The plugin does not inject a polyfill.","severity":"gotcha","affected_versions":"*"},{"fix":"Be aware that some property accesses may not be rewritten; test thoroughly.","message":"Plugin does not transform property access on literals (e.g., 'abc'.length) or built-in objects like Array.prototype. Only object property access is transformed.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: npm install proxy-compat --save","cause":"The runtime dependency 'proxy-compat' is not installed.","error":"Error: Could not find module 'proxy-compat'"},{"fix":"Change import to: import callKey from 'proxy-compat/callKey'; (not from 'proxy-compat')","cause":"Using 'independent' mode but importing the wrong export.","error":"TypeError: callKey is not a function"},{"fix":"Use: const ProxyCompat = require('proxy-compat'); (no .default)","cause":"Using CommonJS require without the correct import pattern.","error":"TypeError: ProxyCompat.callKey is undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}