From ff90a80d74f473e5ae60c2a69c88ad1c5f9f4acf Mon Sep 17 00:00:00 2001 From: rootvector2 Date: Mon, 2 Mar 2026 21:48:22 +0530 Subject: [PATCH 1/4] Add migration note for developmentSourceSelf option --- docs/v8-migration.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/v8-migration.md b/docs/v8-migration.md index 5908a811ec..17d8265292 100644 --- a/docs/v8-migration.md +++ b/docs/v8-migration.md @@ -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)) From 45afda1dee24c60e7e4bbf8933fa38841f491ff9 Mon Sep 17 00:00:00 2001 From: rootvector2 Date: Tue, 3 Mar 2026 05:46:34 +0530 Subject: [PATCH 2/4] Done --- docs/plugin-transform-react-jsx-development.md | 12 ++++++++++++ docs/preset-react.md | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/docs/plugin-transform-react-jsx-development.md b/docs/plugin-transform-react-jsx-development.md index fc41977c9c..4a71259482 100644 --- a/docs/plugin-transform-react-jsx-development.md +++ b/docs/plugin-transform-react-jsx-development.md @@ -120,3 +120,15 @@ require("@babel/core").transformSync("code", { ## Options It accepts the same options as [`@babel/plugin-transform-react-jsx`](./plugin-transform-react-jsx.md#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. + +::: diff --git a/docs/preset-react.md b/docs/preset-react.md index d468c61c67..81b6a87c9e 100644 --- a/docs/preset-react.md +++ b/docs/preset-react.md @@ -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`. From 2cc9480761abef8e7c28444b04286aa1f7fb6eda Mon Sep 17 00:00:00 2001 From: rootvector2 Date: Tue, 3 Mar 2026 06:09:13 +0530 Subject: [PATCH 3/4] moved it --- docs/plugin-transform-react-jsx-development.md | 12 ------------ docs/plugin-transform-react-jsx.md | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/plugin-transform-react-jsx-development.md b/docs/plugin-transform-react-jsx-development.md index 4a71259482..fc41977c9c 100644 --- a/docs/plugin-transform-react-jsx-development.md +++ b/docs/plugin-transform-react-jsx-development.md @@ -120,15 +120,3 @@ require("@babel/core").transformSync("code", { ## Options It accepts the same options as [`@babel/plugin-transform-react-jsx`](./plugin-transform-react-jsx.md#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. - -::: diff --git a/docs/plugin-transform-react-jsx.md b/docs/plugin-transform-react-jsx.md index e4cd72cf55..4066495365 100644 --- a/docs/plugin-transform-react-jsx.md +++ b/docs/plugin-transform-react-jsx.md @@ -374,6 +374,18 @@ Decides which runtime to use. `automatic` auto imports the functions that JSX transpiles to. `classic` does not automatically import anything. +:::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. + +::: + ### React Automatic Runtime #### importSource From 689b77907444845e5a5a811ed4623081049f4947 Mon Sep 17 00:00:00 2001 From: rootvector2 Date: Sat, 7 Mar 2026 01:51:42 +0530 Subject: [PATCH 4/4] fix: move developmentSourceSelf docs to jsx-development plugin Per JLHwung's review, the developmentSourceSelf option is only accepted by the development plugin, not the main plugin-transform-react-jsx. Move the option docs to plugin-transform-react-jsx-development.md, above the 'see options in' sentence. --- docs/plugin-transform-react-jsx-development.md | 12 ++++++++++++ docs/plugin-transform-react-jsx.md | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/plugin-transform-react-jsx-development.md b/docs/plugin-transform-react-jsx-development.md index fc41977c9c..24e61407e7 100644 --- a/docs/plugin-transform-react-jsx-development.md +++ b/docs/plugin-transform-react-jsx-development.md @@ -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). diff --git a/docs/plugin-transform-react-jsx.md b/docs/plugin-transform-react-jsx.md index 4066495365..e4cd72cf55 100644 --- a/docs/plugin-transform-react-jsx.md +++ b/docs/plugin-transform-react-jsx.md @@ -374,18 +374,6 @@ Decides which runtime to use. `automatic` auto imports the functions that JSX transpiles to. `classic` does not automatically import anything. -:::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. - -::: - ### React Automatic Runtime #### importSource