Skip to content

Conversation

jackw
Copy link
Contributor

@jackw jackw commented Jul 23, 2025

What is this PR?

This PR refactors the scenes library to use the automatic jsx transform.

It also updates the rollup config to only build the ts declarations for prod as during dev the package.json types property points to src/index.ts.

Draft right now whilst I test some things out.

Why?

This should solve the 100 odd TS errors that occur when deving scenes against core Grafana.

@jackw jackw self-assigned this Jul 23, 2025
@torkelo
Copy link
Collaborator

torkelo commented Sep 25, 2025

@jackw thanks! anything we can help with?

@jackw
Copy link
Contributor Author

jackw commented Sep 26, 2025

@torkelo thanks but I need put a bit more thought into this one. I was looking to improve the DX with scenes and grafana here but I've discovered plugins that bundle react/jsx-runtime are problematic for upgrading Grafana to React 19. I think the changes in this PR would force all scene apps to bundle react/jsx-runtime which we wanna avoid to make the upgrade as smooth as possible.

It all goes wrong because React 18s react/jsx-runtime relys on __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED which was renamed in React 19. So at runtime we pass React 19 to a plugin but it's bundle contains React 18s react/jsx-runtime and things go 💥 .

There's a breakdown of the plugin upgrade path for React 19 here with more info.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants