Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`agents/vite`: decorator transform fails under isolated installs (Babel plugin resolved by name, `@babel/core@^8` undeclared)

Open Beginner friendly
#2,727 1 comment 0 reactions 0 assignees View on GitHub

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

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

bug

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:

  1. The plugin is passed to Babel by name. src/vite.ts passes ["@babel/plugin-proposal-decorators", { version: "2023-11" }] as a string. Babel resolves the string from the Vite root, not from agents. Under an isolated layout, only agents can 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
    
  2. @babel/core@^8 is required but not declared. Since #1815, agents depends on @babel/plugin-proposal-decorators@^8.0.2, which has a peer dependency on @babel/core@^8. agents declares @babel/core neither 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/core already 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

  1. Create a bun workspace with the isolated linker, [email protected] and vite@8, plus any dependency that pulls in @babel/core@7 (for us, shadcn).
  2. Add agents() to the Vite or Vitest config.
  3. Import an Agent subclass with a @callable() method, and run vite or vitest.
  4. 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' own node_modules:

    import decorators from "@babel/plugin-proposal-decorators"
    
    // ...
    plugins: [[decorators, { version: "2023-11" }]]
    
  • Declare @babel/core (^8.0.0) in agents' dependencies, alongside @babel/plugin-proposal-decorators.

Version:

  • agents 0.30.1 (same code on main @ 8586744)
  • vite 8.3.5, vitest 5.0.5, @cloudflare/vitest-plugin 1.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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/agents

All issues in cloudflare/agents

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.