Skip to content

Commit

Permalink
Add docs for bugfix-firefox-class-in-computed-class-key (#2885)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Apr 3, 2024
1 parent 90125ef commit 6678bf7
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
45 changes: 45 additions & 0 deletions docs/plugin-bugfix-firefox-class-in-computed-class-key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
id: babel-plugin-bugfix-firefox-class-in-computed-class-key
title: "@babel/plugin-bugfix-firefox-class-in-computed-class-key"
sidebar_label: bugfix-firefox-class-in-computed-class-key
---

This bugfix plugin transforms classes inside computed keys of other classes to workaround a [SpiderMonkey bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1887677) 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`](https://terser.org/docs/options/#compress-options) option to `false`.
:::

## Installation

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

## Usage

### With a configuration file (Recommended)

```json title="babel.config.json"
{
"plugins": ["@babel/plugin-bugfix-firefox-class-in-computed-class-key"]
}
```

### Via CLI

```sh title="Shell"
babel --plugins @babel/plugin-bugfix-firefox-class-in-computed-class-key script.js
```

### Via Node API

```js title="JavaScript"
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-bugfix-firefox-class-in-computed-class-key"],
});
```
1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ module.exports = {
type: "category",
label: "Bugfix",
items: [
"babel-plugin-bugfix-firefox-class-in-computed-class-key",
"babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression",
"babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining",
],
Expand Down

0 comments on commit 6678bf7

Please sign in to comment.