forked from babel/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs for plugin-bugfix-safari-class-field-initializer-scope
See babel/babel#16569 Doc structure adapted from `plugin-bugfix-firefox-class-in-computed-class-key`
- Loading branch information
1 parent
97be67f
commit a779407
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
docs/plugin-bugfix-safari-class-field-initializer-scope.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"], | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters