Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.36 KB

plugin-bugfix-firefox-class-in-computed-class-key.md

File metadata and controls

45 lines (33 loc) · 1.36 KB
id title sidebar_label
babel-plugin-bugfix-firefox-class-in-computed-class-key
@babel/plugin-bugfix-firefox-class-in-computed-class-key
bugfix-firefox-class-in-computed-class-key

This bugfix plugin transforms classes inside computed keys of other classes to workaround a SpiderMonkey bug with private class elements.

:::tip This plugin is included in @babel/preset-env, and Babel will automatically enable this plugin for you when your targets are affected by the browser bug. :::

:::warning Terser versions older than 5.30.2 will undo the transform done by this plugin. Make sure to use at least version 5.30.2, or set the Terser's compress.inline option to false. :::

Installation

npm install --save-dev @babel/plugin-bugfix-firefox-class-in-computed-class-key

Usage

With a configuration file (Recommended)

{
  "plugins": ["@babel/plugin-bugfix-firefox-class-in-computed-class-key"]
}

Via CLI

babel --plugins @babel/plugin-bugfix-firefox-class-in-computed-class-key script.js

Via Node API

require("@babel/core").transformSync("code", {
  plugins: ["@babel/plugin-bugfix-firefox-class-in-computed-class-key"],
});