Skip to content

Conversation

@jackw
Copy link
Collaborator

@jackw jackw commented Feb 12, 2026

What this PR does / why we need it:

The approaching move to React 19 in Grafana core codebase has highlighted an issue with plugins that are bundling react/jsx-runtime which expects a specific version of React as it uses the react internals API. This PR aims to address this with the following:

  • bump grafanaDependency to 12.3.0 in plugin.json for new plugin scaffolds
  • make react/jsx-runtime and react/jsx-dev-runtime externalised for new plugin scaffolds
  • provide an addition codemod that plugin devs can run manually to externalize jsx-runtime for existing plugins

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Can be tested by using the canary release version from below like so npx @grafana/create-plugin@canary add externalize-jsx-runtime

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install website@5.5.0-canary.2448.21942905946.0
npm install @grafana/create-plugin@6.9.0-canary.2448.21942905946.0
# or 
yarn add website@5.5.0-canary.2448.21942905946.0
yarn add @grafana/create-plugin@6.9.0-canary.2448.21942905946.0

@jackw jackw self-assigned this Feb 12, 2026
@jackw jackw requested review from a team as code owners February 12, 2026 09:50
@jackw jackw requested review from academo and Copilot February 12, 2026 09:50
@jackw jackw added minor Increment the minor version when merged patch Increment the patch version when merged labels Feb 12, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

Hello! 👋 This repository uses Auto for releasing packages using PR labels.

✨ This PR can be merged and will trigger a new minor release.
NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.

@jackw jackw requested review from ashharrison90 and hugohaggmark and removed request for academo, oshirohugo and toddtreece February 12, 2026 09:50
@jackw jackw moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team Feb 12, 2026
@jackw jackw added release Create a release when this pr is merged and removed patch Increment the patch version when merged labels Feb 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates @grafana/create-plugin scaffolds and tooling to avoid bundling react/jsx-runtime (and react/jsx-dev-runtime) so plugins don’t couple themselves to React internals as Grafana moves toward React 19.

Changes:

  • Bump scaffolded plugins’ grafanaDependency to >=12.3.0 (app/panel/datasource/scenes-app templates).
  • Externalize react/jsx-runtime and react/jsx-dev-runtime in the common bundler externals template.
  • Add AST utilities + a new “externalize-jsx-runtime” addition codemod (with tests) to retrofit existing plugins.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/create-plugin/templates/scenes-app/src/plugin.json Bumps default Grafana dependency for new scenes-app scaffolds.
packages/create-plugin/templates/panel/src/plugin.json Bumps default Grafana dependency for new panel scaffolds.
packages/create-plugin/templates/datasource/src/plugin.json Bumps default Grafana dependency for new datasource scaffolds.
packages/create-plugin/templates/app/src/plugin.json Bumps default Grafana dependency for new app scaffolds.
packages/create-plugin/templates/common/.config/bundler/externals.ts Adds react/jsx-runtime and react/jsx-dev-runtime to scaffold externals list.
packages/create-plugin/src/codemods/utils.ts Adds a helper to render template files for codemods (with optional warning injection).
packages/create-plugin/src/codemods/utils.ast.ts Introduces reusable recast AST helpers for codemods.
packages/create-plugin/src/codemods/utils.ast.test.ts Adds unit tests for the new AST helpers.
packages/create-plugin/src/codemods/additions/scripts/externalize-jsx-runtime.ts New addition codemod to externalize jsx runtimes and adjust plugin.json ranges.
packages/create-plugin/src/codemods/additions/scripts/externalize-jsx-runtime.test.ts Tests for the new addition codemod behavior and idempotency.

Copy link
Contributor

@hugohaggmark hugohaggmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did an initial pass and it looks good but I added some comments, I'm going to test this locally as well

@jackw jackw force-pushed the jackw/jsx-runtime-codemod branch from c8f1fd8 to d0277cb Compare February 12, 2026 10:29
@hugohaggmark
Copy link
Contributor

Maybe nothing but I get this warning in the IDE
image

Copy link
Contributor

@hugohaggmark hugohaggmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work 🚀

  • tested on an existing rspack project
  • tested on an existing webpack project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Increment the minor version when merged release Create a release when this pr is merged

Projects

Status: 🔬 In review
Status: 🔍 In review

Development

Successfully merging this pull request may close these issues.

2 participants