Skip to content

Commit

Permalink
docs: improve babel page (#2832)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmillio authored Nov 24, 2024
1 parent 6b406ff commit 94c186e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions docs/tools/babel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ With a `babel` configuration file:
}
```

You can also supply your atom names to the plugin:
The plugin recognizes a predefined list of atom function names (e.g. 'atom', 'atomFamily', 'atomWithDefault'). If you’re using custom atom function names, you can explicitly supply them to ensure they are recognized.

Here’s how you can configure it in your Babel setup:

```json
{
Expand Down Expand Up @@ -70,6 +72,8 @@ export default countAtom

### Usage

It is recommended to disable this plugin for production builds to avoid unnecessary overhead. You can conditionally include it in your Babel configuration based on the environment.

With a `babel` configuration file:

```json
Expand All @@ -78,7 +82,9 @@ With a `babel` configuration file:
}
```

You can also supply your atom names to the plugin:
The plugin recognizes a predefined list of atom function names (e.g. 'atom', 'atomFamily', 'atomWithDefault'). If you’re using custom atom function names, you can explicitly supply them to ensure they are recognized.

Here’s how you can configure it in your Babel setup:

```json
{
Expand All @@ -92,7 +98,7 @@ Examples can be found below.

## babel/preset

Jotai ships with a `babel` containing the plugins created for Jotai.
Jotai ships with a `babel preset` containing the plugins created for Jotai.

### Usage

Expand Down

0 comments on commit 94c186e

Please sign in to comment.