{"id":20513796,"url":"https://github.com/webreflection/babel-plugin-transform-builtin-classes","last_synced_at":"2025-08-13T06:10:19.747Z","repository":{"id":65993102,"uuid":"95555674","full_name":"WebReflection/babel-plugin-transform-builtin-classes","owner":"WebReflection","description":"A fix for the infamous Babel #4480 bug.","archived":false,"fork":false,"pushed_at":"2018-09-03T15:04:22.000Z","size":39,"stargazers_count":43,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-19T09:22:14.575Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/babel/babel/issues/4480","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebReflection.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-06-27T12:26:07.000Z","updated_at":"2020-05-29T07:40:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"d2ae9461-3c0b-49b9-af4f-ae41c85148f4","html_url":"https://github.com/WebReflection/babel-plugin-transform-builtin-classes","commit_stats":{"total_commits":36,"total_committers":2,"mean_commits":18.0,"dds":0.02777777777777779,"last_synced_commit":"ca32b250d5035670cc1c1e079dd92582958f0a99"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/WebReflection/babel-plugin-transform-builtin-classes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fbabel-plugin-transform-builtin-classes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fbabel-plugin-transform-builtin-classes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fbabel-plugin-transform-builtin-classes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fbabel-plugin-transform-builtin-classes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebReflection","download_url":"https://codeload.github.com/WebReflection/babel-plugin-transform-builtin-classes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fbabel-plugin-transform-builtin-classes/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270191516,"owners_count":24542273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T21:13:10.730Z","updated_at":"2025-08-13T06:10:19.661Z","avatar_url":"https://github.com/WebReflection.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Babel Builtin Classes Fix\n\n[![Build Status](https://travis-ci.org/WebReflection/babel-plugin-transform-builtin-classes.svg?branch=master)](https://travis-ci.org/WebReflection/babel-plugin-transform-builtin-classes) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000\u0026style=flat)](https://github.com/WebReflection/donate)\n\n### About Babel 7\n\nBabel 7 included this plugin in core so you don't need this plugin anymore.\n\n- - -\n\nInspired by [Logan Smyth transformer](https://github.com/loganfsmyth/babel-plugin-transform-builtin-extend),\nbut actually very different.\n\nThis transformer aim is to fix once forever problems with native extends and Custom Elements.\n\n```js\n// finally fixed\nclass List extends Array {}\nconsole.assert(new List instanceof List);\n\n// finally fixed too\nclass MyElement extends HTMLElement {\n  connectedCallback() {\n    this.textContent = 'hello';\n  }\n}\n\ncustomElements.define('my-element', MyElement);\n\nconst node = new MyElement;\nconsole.assert(node.constructor === MyElement);\nconsole.assert(node instanceof MyElement);\nconsole.assert(node instanceof HTMLElement);\n\ndocument.body.appendChild(node);\n```\n\n## Usage\n\nIn your Babel 6 configuration, for example in a `.babelrc` you might have the following,\nwhich would enable the plugin and configure it to look for any class extending `HTMLElement`, `Error` or `Array` globals.\n\n```js\n{\n  \"plugins\": [\n    // either the preset es2015 or at least the following\n    \"babel-plugin-transform-es2015-classes\",\n    [\"babel-plugin-transform-builtin-classes\", {\n      \"globals\": [\"Array\", \"Error\", \"HTMLElement\"]\n    }]\n  ]\n}\n```\n\n**However**, you can find all known Chrome browser classes already listed in the file `lib/.babelrc` too.\n\n#### Rollup\n\nIn this case you might need to invert the plugins order:\n```js\n{\n  plugins: [\n    ['transform-builtin-classes', {\n      globals: ['HTMLElement']\n    }],\n    'transform-es2015-classes'\n    // ... others ...\n  ]\n}\n```\n\n\n### Compatibility\nThis transformer works on IE11 and every other browser with `Object.setPrototypeOf` or `__proto__` as fallback.\n\nThere is **NO IE \u003c= 10 support**. If you need IE \u003c= 10 don't use this plugin and/or don't extend natives (recommended).\n\n\n### About `logIfPatched` option\nIf you'd like to have a visual feedback when patched classes are encountered,\nuse the `logIfPatched: true` option.\n\n```js\n{\n  \"plugins\": [\n    ['transform-builtin-classes', {\n      globals: ['Array'],\n      logIfPatched: true\n    }]\n  ]\n}\n```\n\nThis will output (as `console.warn`) `✔ builtin extends patched` whenever a class is found.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fbabel-plugin-transform-builtin-classes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebreflection%2Fbabel-plugin-transform-builtin-classes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fbabel-plugin-transform-builtin-classes/lists"}