# Migrate a SolidJS App from Rollup to Vite

Yes. An agent replaces a hand-written Rollup and Babel setup in your SolidJS app with Vite and vite-plugin-solid, keeps the build output working and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/migrate-rollup-to-vite/solidjs/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads the build before touching it. In an app like solidjs/solid-realworld, `package.json` pins `rollup` 2.52.3 with `@rollup/plugin-babel` 5.2.0, `@babel/core` 7.12.13, `babel-preset-solid`, the optional-chaining and dynamic-import Babel plugins, `@rollup/plugin-node-resolve`, `@rollup/plugin-commonjs`, `rollup-plugin-delete`, `rollup-plugin-terser` and `serve`; the runtime dependencies are `solid-js` ^1.3.3 and `marked`. `rollup.config.js` takes `src/index.js`, emits ES modules into `public/` and runs Terser only when `--environment production` is set. The `start` script runs `serve public -l 5000 -s` in the background beside `rollup -w -c`, `build` is `rollup -c --environment production`, and `test` is the placeholder string `test`. `public/index.html` loads `./index.js` as a module and pulls the theme CSS and fonts from CDNs, and `.gitignore` ignores everything in `public/` except that file. Every component is JSX inside a `.js` file, and `src/App.js` uses `Show`, `Suspense`, `Switch` and `Match` without importing them, relying on the preset's built-in auto-import.

From that the agent sets up Vite. It adds `vite` and `vite-plugin-solid` as dev dependencies and writes `vite.config.js` with the Solid plugin. Vite's esbuild pass does not parse JSX in `.js` files, so the agent renames the component files to `.jsx` with `git mv` so history follows; the imports already omit extensions, so they keep resolving. It checks whether the plugin's default preset options still auto-import the control-flow components `App.js` relies on and, where they do not, adds the imports from `solid-js` explicitly, which also reads better. The two Babel plugins for optional chaining and dynamic import go away, because both are plain syntax for the browsers Vite targets, and `lazy(() => import(...))` in the page `index.js` files keeps producing split chunks.

`index.html` moves from `public/` to the project root, as Vite's entry, with its script tag pointing at `/src/index.jsx`; the CDN links for the RealWorld theme and the preconnect hints stay as they are. Output moves to `dist/`, so `.gitignore` drops the `public/*` rule and ignores `dist` instead, and `public/` becomes Vite's static directory. The scripts become `dev` running `vite`, `build` running `vite build` and `preview` running `vite preview`; `serve`, `rollup-plugin-delete` and `rollup-plugin-terser` leave `devDependencies`, since Vite clears the output directory and minifies on its own. The hash-based router in `src/store` is untouched, because it never depended on the bundler. The repository's GitHub Pages workflow builds with Node 14 and publishes `./public`; the agent points it at `./dist`, moves it to a current Node and, because the demo is served under a repository sub-path, sets Vite's `base` for that deploy and explains the option in the pull request.

The proof is the build. `npm run build` completes with the chunks for the lazily loaded pages listed in Vite's output, `npm run preview` serves `dist/` and a request to the index returns the page with its module script, and `npm run dev` starts without a JSX parse error on any renamed file. There is no test suite to run, and the pull request says so rather than inventing one.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Migrate this SolidJS app from Rollup and Babel to Vite. Read package.json, rollup.config.js, public/index.html, .gitignore, the GitHub Actions workflow and every file under src first. Add vite and vite-plugin-solid, write vite.config.js, rename the JSX component files from .js to .jsx with git mv, add explicit solid-js imports for any control-flow component the current Babel preset auto-imports if the Vite plugin does not, move index.html to the project root with its script pointing at the new entry, keep the CDN stylesheet links, switch the output to dist and update .gitignore, replace the start and build scripts with vite, vite build and vite preview, remove the Rollup, Babel and serve dev dependencies that are no longer used, and regenerate package-lock.json. Update the GitHub Pages workflow to publish dist on a current Node version and set Vite's base if the site deploys under a sub-path. Run the build and the preview server, request the index page, start the dev server once to confirm every file parses, and open a pull request that lists each renamed file and each removed dependency.",
  "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 `vite.config.js`, the root `index.html`, the renamed `.jsx` files under `src/`, the new `package.json` scripts and dependency list, a regenerated `package-lock.json`, the changed `.gitignore` and the updated workflow; `rollup.config.js` is deleted. The store, the pages and the components keep their logic, with only import lines added where a control-flow component needed one.

The description lists the files renamed, the dependencies removed, the build output with its chunk list, and the preview request and its response status. The commands and their output are in the transcript at `GET /o/{org}/sessions/{id}/messages`, so a reviewer can read the build without running it.

Before merging, a reviewer runs `npm run dev` on a laptop to click through the hash routes, checks the Pages workflow on the branch, and decides whether to add Vitest now that Vite is in place, which the pull request names as the natural next step but does not do.

## Run it on every repository still on Rollup

Start one run per app from your own server: `POST /o/{org}/sessions` with this prompt and that repository in `resources`, one call each. `GET /o/{org}/github` lists every repository the Rush GitHub App installation can reach, so a script can find the ones with a `rollup.config.js` and start a run for each. Each run has its own sandbox and its own branch.

Give the key a `webhook_url` and each run POSTs `run.completed` with its `session_url` when the turn finishes, so the pull request links collect on your side without polling. A key may have at most `max_concurrent` runs in progress at once, 4 by default, and a script over many repositories can still start them all in one loop: each run past the limit answers `202` with `status: "queued"` and starts, oldest first, when a slot frees.

## Why run it on Rush?

A bundler migration is a loop of rename, run, read the parse error, fix, run again, and on a laptop every pass interrupts other work. In a Rush sandbox the agent runs that loop itself with the real `node_modules` installed: the JSX-in-`.js` error, the missing control-flow import and the moved `index.html` each show up in a command's output and get fixed before the branch is pushed.

The result is a build that has already run, with its output in the transcript next to the command, not a config file to try later. Several apps can be migrated at once, each in its own sandbox and pull request, and anything left out, such as a test runner, is named with the reason.

## Frequently asked questions

### Why rename the files to .jsx?

Vite hands `.js` files to esbuild as plain JavaScript and stops at the first JSX tag with a parse error. Renaming to `.jsx` is the documented fix and makes the file type visible; because the imports in this codebase omit extensions, they resolve to the renamed files without edits.

### Will the code-split pages still load lazily?

Yes. The `lazy(() => import(...))` calls in `src/App.js` and the page `index.js` files are standard dynamic imports, which Vite turns into separate chunks. The build output lists each chunk, and the pull request pastes that list.

### What about the components used without an import?

The Babel preset the Rollup config uses can inject imports for Solid's control-flow components. The agent checks whether the Vite plugin keeps that behaviour in its default options and adds the `solid-js` imports explicitly where it does not, so the result does not depend on a preset flag.

### Does the GitHub Pages deploy keep working?

The workflow is updated to publish `dist/` instead of `public/` on a current Node version. A site served under a repository sub-path needs Vite's `base` set to that path for the asset URLs to resolve, which the agent sets for that deploy and documents.

## More SolidJS jobs

- [Migrate a Hand-Rolled Hash Router to @solidjs/router in a SolidJS App](https://getrush.ai/run/migrate-to-solid-router/solidjs/)
- [Upgrade npm Dependencies in a SolidJS App](https://getrush.ai/run/upgrade-npm-dependencies/solidjs/)
- [Write Component Tests for a SolidJS App](https://getrush.ai/run/write-component-tests/solidjs/)

## More jobs like this: Hand off a long task

- [Migrate a Python Project from setup.py to pyproject.toml](https://getrush.ai/run/migrate-setup-py-to-pyproject/python/)
- [Move a Slack Bolt App From Socket Mode to HTTP](https://getrush.ai/run/migrate-socket-mode-to-http/slack-bolt/)
- [Migrate an Echo and GORM API From SQLite to Postgres](https://getrush.ai/run/migrate-sqlite-to-postgres/echo/)

## 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/)
