`agents/vite`: decorator transform fails under isolated installs (Babel plugin resolved by name, `@babel/core@^8` undeclared)
Maintainers usually reply within 1 day
@akhil9tiet is already working on this.
Since Oct 27, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- bun, typescript, vite
- Domain
- build-system, testing
Research direction
Start with packages/agents/src/vite.ts around the Babel plugin configuration and packages/agents/package.json, which the issue identifies as the relevant files. Check how the decorator plugin is resolved and whether the package declares the Babel core version it requires. Reproduce with Vite or Vitest using an isolated Bun install; done when agents() loads the decorator transform without consumer-added Babel dependencies.
Written by the indexing model from the issue text.
Description
Describe the bug
agents() from agents/vite fails to load its Babel decorator transform when transitive dependencies aren't hoisted to the project root. We hit it with bun's isolated linker, running Vitest + @cloudflare/vitest-plugin on Vite 8 for a Worker with @callable() methods. There are two causes:
-
The plugin is passed to Babel by name.
src/vite.tspasses["@babel/plugin-proposal-decorators", { version: "2023-11" }]as a string. Babel resolves the string from the Vite root, not fromagents. Under an isolated layout, onlyagentscan see the plugin, so resolution fails:Error: [BABEL] <root>/tests/globalSetup.ts: Cannot find package '@babel/plugin-proposal-decorators' imported from <root>/babel-virtual-resolve-base.js Plugin: @rolldown/plugin-babel -
@babel/core@^8is required but not declared. Since #1815,agentsdepends on@babel/plugin-proposal-decorators@^8.0.2, which has a peer dependency on@babel/core@^8.agentsdeclares@babel/coreneither as a dependency nor as a peer. pnpm and npm install the missing peer automatically, which is why this repo's own lockfile gets@babel/[email protected]. Bun instead links whatever@babel/corealready exists in the tree. In our case that is 7.29.x, pulled in by an unrelated package. We haven't seen the resulting failure yet, because cause 1 fails first.
To Reproduce
- Create a bun workspace with the isolated linker,
[email protected]andvite@8, plus any dependency that pulls in@babel/core@7(for us,shadcn). - Add
agents()to the Vite or Vitest config. - Import an
Agentsubclass with a@callable()method, and runviteorvitest. - The Babel error above is thrown.
Expected behavior
agents() transforms decorators regardless of the package manager's node_modules layout, with no extra direct dependencies in the consuming project.
Suggested fix
-
Import the plugin and pass the function, so it resolves from
agents' ownnode_modules:import decorators from "@babel/plugin-proposal-decorators" // ... plugins: [[decorators, { version: "2023-11" }]] -
Declare
@babel/core(^8.0.0) inagents'dependencies, alongside@babel/plugin-proposal-decorators.
Version:
agents0.30.1 (same code onmain@8586744)vite8.3.5,vitest5.0.5,@cloudflare/vitest-plugin1.4.8- bun 1.4.2, isolated linker
Additional context
Our current workaround is adding @babel/core@^8 and @babel/plugin-proposal-decorators@^8 as devDependencies of the consuming app. Production bundles via wrangler/esbuild are unaffected, since esbuild lowers the decorators itself; only Vite-based builds and tests hit this.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 814
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 170
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudflare/agents
-
createAI: the ai peer range allows ai@6, which the provider cannot work withMay be free again @akhil9tiet claimed this 7 days ago, and no pull request is open. Openbug
Difficulty 1/5 Under an hour Newbie friendliness 83/100
cloudflare/agents#2690 · 3 comments ·
Maintainers usually reply within 1 day
-
createAI: text-only user content is joined with no separator, which glues parts together and breaks code fencesMay be free again @akhil9tiet claimed this 8 days ago, and no pull request is open. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
cloudflare/agents#2682 · 2 comments ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
cloudflare/agents#2645 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/agents#2635 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cloudflare/agents#2629 · 1 comment ·
Maintainers usually reply within 1 day
All issues in cloudflare/agents
Similar issues
-
Replace discontinued crypto-js in the themePossibly taken @aelmanaa claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
PaloAltoNetworks/docusaurus-openapi-docs#1689 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
solana-foundation/solana-web3.js#4015 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
ivopogace/opencode-courier#422 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
chapel-lang/chapel-vscode#158 ·
Maintainers usually reply within 1 day