Skip to content

Commit

Permalink
Add docs for plugin-bugfix-safari-class-field-initializer-scope
Browse files Browse the repository at this point in the history
See babel/babel#16569

Doc structure adapted from `plugin-bugfix-firefox-class-in-computed-class-key`
  • Loading branch information
davidtaylorhq committed Jul 11, 2024
1 parent 97be67f commit 024e9c3
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docs/plugin-bugfix-safari-class-field-initializer-scope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
id: babel-plugin-bugfix-safari-class-field-initializer-scope
title: "@babel/plugin-bugfix-safari-class-field-initializer-scope"
sidebar_label: bugfix-safari-class-field-initializer-scope
---

This bugfix plugin wraps some class field initializers with an IIFE to workaround [a WebKit bug](https://webkit.org/b/236843) which affects Safari 15.

:::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.
:::

## Installation

```shell npm2yarn
npm install --save-dev @babel/plugin-bugfix-safari-class-field-initializer-scope
```

## Usage

### With a configuration file (Recommended)

```json title="babel.config.json"
{
"plugins": ["@babel/plugin-bugfix-safari-class-field-initializer-scope"]
}
```

### Via CLI

```sh title="Shell"
babel --plugins @babel/plugin-bugfix-safari-class-field-initializer-scope script.js
```

### Via Node API

```js title="JavaScript"
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-bugfix-safari-class-field-initializer-scope"],
});
```

0 comments on commit 024e9c3

Please sign in to comment.