Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/plugin-transform-react-jsx-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,16 @@ require("@babel/core").transformSync("code", {

## Options

:::babel8

#### `developmentSourceSelf`

`boolean`, defaults to `false`.

When `true`, the plugin generates `__source` and `__self` arguments in `jsxDEV` calls. These were used by older versions of React for development warnings but have been removed since React 19.2.

Set this to `true` if you are using a React version older than 19.2 or a custom JSX runtime that depends on these arguments.

:::

It accepts the same options as [`@babel/plugin-transform-react-jsx`](./plugin-transform-react-jsx.md#options).
12 changes: 12 additions & 0 deletions docs/preset-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ This toggles behavior specific to development, such as adding `__source` and `__

This is useful when combined with the [env option](options.md#env) configuration or [js config files](config-files.md#javascript).

:::babel8

#### `developmentSourceSelf`

`boolean`, defaults to `false`.

When `true`, the plugin generates `__source` and `__self` arguments in `jsxDEV` calls. These were used by older versions of React for development warnings but have been removed since React 19.2.

Set this to `true` if you are using a React version older than 19.2 or a custom JSX runtime that depends on these arguments.

:::

#### `throwIfNamespace`

`boolean`, defaults to `true`.
Expand Down
15 changes: 15 additions & 0 deletions docs/v8-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,21 @@ The following syntax plugins are no longer needed, you can safely remove them fr

**Migration**: The preset will also report invalid option names. Refer to the [docs](./preset-react.md#options) and ensure valid usage.

- Stop generating `__source` and `__self` in development mode by default ([#17571](https://github.com/babel/babel/issues/17571))

React 19.2 removed the `source` and `self` parameters from `jsxDEV`. Babel 8 no longer passes them when calling `jsxDEV` in development mode.

**Migration**: If you are using React 19.2 or later you don't need to do anything. If you are using an older React version or a custom JSX runtime that still expects these arguments, set `developmentSourceSelf` to `true`:

```diff title="babel.config.json"
{
"presets": [
- ["@babel/preset-react", { "development": true }]
+ ["@babel/preset-react", { "development": true, "developmentSourceSelf": true }]
]
}
```

![low](https://img.shields.io/badge/risk%20of%20breakage%3F-low-yellowgreen.svg)

- Disallow `filter` option in automatic runtime ([#15068](https://github.com/babel/babel/pull/15068/commits/e2dd3be6e38b0254bc69a8e52c265214235829c6))
Expand Down