Skip to content
Open
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
2 changes: 1 addition & 1 deletion docs/preset-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ This is useful when combined with the [env option](options.md#env) configuration

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.
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, such as `preact`.

#### `throwIfNamespace`

Expand Down
32 changes: 30 additions & 2 deletions docs/v8-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,34 @@ The following syntax plugins are no longer needed, you can safely remove them fr

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` in the preset, or `sourceSelf` to `true` in `@babel/plugin-transform-react-jsx-development`:
```jsx title="in.jsx"
function Example () {
return <span>Foo</span>
}
```

```js title="out.js"
// Babel 8
function Example() {
return /*#__PURE__*/_jsxDEV("span", {
children: "Foo"
}, void 0, false);
}

// Babel 7
var _jsxFileName = "..."
function Example() {
return /*#__PURE__*/_jsxDEV("span", {
children: "Foo"
}, void 0, false, {
fileName: _jsxFileName,
lineNumber: 2,
columnNumber: 10
}, this);
}
```

**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, such as `preact`, set `developmentSourceSelf` to `true` in the preset, or `sourceSelf` to `true` in `@babel/plugin-transform-react-jsx-development`:

```diff title="babel.config.json"
{
Expand All @@ -497,7 +524,8 @@ The following syntax plugins are no longer needed, you can safely remove them fr
]
}
```
```diff title="babel.config.json"

```diff title="babel.config.json"
{
"plugins": [
- "@babel/plugin-transform-react-jsx-development",
Expand Down