aws / aws/graph-explorer

Move babel-plugin-react-compiler to devDependencies

Open
#2,157 0 comments 0 reactions 0 assignees View on GitHub
dependencies internal ready-for-agent tech debt
Dominant language
TypeScript
Stars
481
Forks
108
Avg merge
6d 8h
Merged PRs (30d)
5

Description

`babel-plugin-react-compiler` is declared in `packages/graph-explorer/package.json` under `dependencies`, but it is build-time tooling. It ships into the runtime image as a result.

Nothing in `src/` imports it. It reaches the build through `vite.config.ts`, which calls `reactCompilerPreset()` from `@vitejs/plugin-react` and hands it to `@rolldown/plugin-babel`. The workspace root already declares it correctly in `devDependencies`.

The reason it ends up in the image is the `Dockerfile` sequence: `pnpm install --frozen-lockfile` (full), `pnpm build`, `pnpm clean:dep`, then `pnpm install --prod --frozen-lockfile --ignore-scripts`. The build runs against the full install, so moving the entry to `devDependencies` won't affect it — but the `--prod` install afterwards keeps anything in `dependencies`, so the plugin and its closure (about 3.7 MB) land in the shipped image for nothing.

## Work

Move `babel-plugin-react-compiler` from `dependencies` to `devDependencies` in `packages/graph-explorer/package.json`. Leave the root declaration alone.

## Acceptance

`pnpm build` still emits the compiler's memoization (the output should contain `react/compiler-runtime` imports with cache slots — a quick way to confirm the preset still ran), `pnpm checks` and `pnpm test` pass, the image builds, and `babel-plugin-react-compiler` is absent from the built image's `node_modules`.

> [!IMPORTANT]
> Internal only — this issue is maintained by the core team and is not accepting external contributions.

Contributor guide

Open the contributing guide

Research direction

Edit packages/graph-explorer/package.json, moving babel-plugin-react-compiler while leaving the workspace root unchanged. Read vite.config.ts and the Dockerfile first, then run pnpm build, pnpm checks, pnpm test, and the image build. Done means compiler memoization remains in the build output and the plugin is absent from the shipped image's node_modules.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, react, typescript, vite
Domain
build-system, devops
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.