# Upgrade a Chrome Extension to React 19

Yes. An agent upgrades the React 18 popup and options pages of your Chrome extension to React 19, rebuilds the webpack bundles, runs the tests, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/upgrade-react-19/chrome-extension/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads what the extension is built from before touching a version. In a project like chibat/chrome-extension-typescript-starter, `package.json` asks for `react` and `react-dom` `^18.2.0`, resolved to `18.3.1` in `package-lock.json`, with `@types/react` `18.3.28` and `@types/react-dom` `18.3.7`, TypeScript `5.9.3`, `ts-loader` `8.4.0`, webpack `5.105.3`, jest `29.7.0` with `ts-jest`, and `@types/chrome` pinned at `0.0.158`. `tsconfig.json` uses `"jsx": "react"`, the classic runtime, which is why `popup.tsx` and `options.tsx` both start with `import React`. Both files already render through `createRoot` from `react-dom/client` inside `React.StrictMode`, the popup counts clicks into `chrome.action.setBadgeText` and sends a colour to the content script with `chrome.tabs.sendMessage`, and the options page reads and writes `chrome.storage.sync`. `webpack/webpack.common.js` builds four entries and splits a shared `vendor` chunk for everything except `background`, which `public/popup.html` and `options.html` load before their own script. The only test is `src/__tests__/sum.ts`, and `.github/workflows/build.yml` runs `npm ci`, `npm run build` and `npm test` on Node 20 and 22.

Then it does the upgrade in the order the React 19 upgrade guide gives. `react`, `react-dom`, `@types/react` and `@types/react-dom` move to 19 together, and the agent runs the official types codemod for React 19 over `src/` so type changes that affect this code are applied mechanically rather than by hand. It then checks what the guide lists against what the extension uses: `ReactDOM.render`, `findDOMNode`, string refs, `propTypes` and the UMD builds are absent, `createRoot` is already the React 18 API that 19 keeps, and the two components use only `useState` and `useEffect`. The classic `jsx` setting still works under 19; the agent switches `tsconfig.json` to `react-jsx` and drops the now-unused `import React` lines only if `ts-loader` compiles cleanly with it, and otherwise says in the pull request why the setting stays.

StrictMode matters for an extension: it double-invokes effects in development builds, and the popup's first effect writes the badge text and the second queries the active tab, both of which are safe to repeat. The agent reads them anyway and notes it, because an effect that sent a message twice would be a real change in behaviour for the content script. `@types/chrome` stays where it is, since it has nothing to do with React, and `ts-loader` 8 already compiles TypeScript 5.9 in this lock file.

The proof is the build and the bundle. `npm install` regenerates the lock file, `npm run build` runs webpack in production mode, `npx tsc --noEmit` type-checks the sources outside webpack, and `npm test` runs jest. The agent reads the built `dist/js/vendor.js` to confirm it carries React 19 and not a second copy of 18, checks the manifest and the HTML pages still reference the same files, and lists the bundle sizes before and after from the webpack output, which it read rather than estimated.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Upgrade this Chrome extension from React 18 to React 19. Read package.json, package-lock.json, tsconfig.json, tsconfig.test.json, jest.config.js, webpack/webpack.common.js, public/manifest.json, public/popup.html, public/options.html and every file under src first. Move react, react-dom, @types/react and @types/react-dom to 19 together, run the official React 19 types codemod over src, and check each removal in the React 19 upgrade guide against this code. Switch tsconfig to the react-jsx runtime and drop unused React imports only if ts-loader builds cleanly with it; otherwise keep the classic runtime and say why. Leave @types/chrome and the webpack setup alone. Run npm install, npm run build, npx tsc --noEmit and npm test, confirm dist/js/vendor.js carries React 19 and no second React copy, note the bundle sizes webpack printed before and after, and open a pull request listing every change and anything the guide mentions that this extension does not use.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request on its own branch with `package.json` and `package-lock.json` moved to React 19 and its types, any edits the codemod made under `src/`, and either the `react-jsx` setting in `tsconfig.json` with the `import React` lines removed from `popup.tsx` and `options.tsx`, or a note that the classic runtime stays. `manifest.json`, the HTML pages, the webpack config and `background.ts` are untouched.

The description lists each item from the upgrade guide and whether the extension used it, the webpack output with the four entries and the `vendor` chunk before and after, the `tsc --noEmit` result and the jest summary. The transcript at `GET /o/{org}/sessions/{id}/messages` keeps the install, the build and the test run with their output.

Before merging, a reviewer loads `dist/` as an unpacked extension once, opens the popup and the options page, and checks the badge count and the saved colour still work, since no test covers the browser APIs. If the pull request kept the classic runtime, a follow-up message to the same session can try `react-jsx` again with the reason the first attempt failed.

## Run it on every Monday morning

A team that upgrades on a schedule adds an automation with a `schedule` trigger, a `cron` expression for the hour they want and their `timezone`, with this prompt and the repository. Each run checks out the current branch, so a week where the upgrade already landed ends with no pull request and a sentence saying so.

Each run opens one pull request on its own branch from its own sandbox, and an automation run has its own `max_runs_per_hour` cap. The pull request lists what moved and what the guide mentioned that this extension never used, so the review is a read rather than a search.

## Why run it on Rush?

A major React upgrade in an extension is small in lines and large in questions: which removals apply, whether the JSX runtime can change, what StrictMode's double effects do to `chrome.*` calls, and whether the built `vendor` chunk ends up with one React or two. The agent answers each from the files and the build output in its own sandbox rather than from a changelog summary.

The pull request carries the evidence: the webpack output, the bundle check, `tsc --noEmit` and jest are in the transcript beside the commands that produced them, and the description says which guide items were checked and found unused. Several extension repositories can be handled at once, one sandbox and one pull request each.

## Frequently asked questions

### Does the extension have to change its JSX runtime?

No. The classic `"jsx": "react"` setting in `tsconfig.json` keeps working under React 19, which is why both components import React today. The agent tries `react-jsx` because it removes those imports and the build is simpler, and keeps the classic runtime with a note if `ts-loader` or the test config objects.

### What about StrictMode running effects twice?

That is a development-mode behaviour React 18 already had, and the two effects in `popup.tsx` set the badge text and query the active tab, which are safe to repeat. The agent reads them and says so; an effect that sent a message to the content script would deserve a guard, and the pull request would add one.

### Will @types/chrome or webpack need to move too?

No. `@types/chrome` describes the browser APIs and has no React dependency, and `ts-loader` 8 already compiles the TypeScript 5.9 the lock file resolves. The agent leaves both alone so the pull request is only the React upgrade.

### How do I know the bundle has one React?

The agent reads the built `dist/js/vendor.js` for the React version it carries and checks that no entry bundles a second copy, and it lists the sizes webpack printed. A reviewer repeats the check with `npm run build` locally if they want to see it themselves.

## More Chrome Extension jobs

- [Write Tests for a Chrome Extension](https://getrush.ai/run/write-extension-tests/chrome-extension/)
- [Add a Context Menu Item to a Chrome Extension from a Linear Issue](https://getrush.ai/run/add-context-menu/chrome-extension/)
- [Add Code Coverage to CI for a Chrome Extension](https://getrush.ai/run/add-coverage-to-ci/chrome-extension/)

## The same job on other stacks

- [Upgrade a Vite React App to React 19](https://getrush.ai/run/upgrade-react-19/vite-react/)

## More jobs like this: Upgrade dependencies weekly

- [Upgrade RQ 1.x to RQ 3 in a Flask App](https://getrush.ai/run/upgrade-rq/rq/)
- [Upgrade a Scrapy Project to the Latest Scrapy](https://getrush.ai/run/upgrade-scrapy/scrapy/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
