Describe the bug
When an esbuild plugin registered through optimizeDeps.esbuildOptions.plugins uses build.onEnd, Vite's Rolldown compatibility converter passes a BuildResult proxy that throws for every property access.
This breaks plugins that use normal esbuild behavior such as checking result.metafile. With esbuild, result.metafile is simply undefined when no metafile is generated.
I plan to submit a small PR for this.
Reproduction
No repo is needed. The following commands reproduce it with the current Vite+ package, which packages Vite's Rolldown-based optimizer path:
cd /tmp
vp create create-astro -- vp-astro-repro --template minimal --yes --no-git --install
cd /tmp/vp-astro-repro
pnpm build
A plain Astro project succeeds:
cd /tmp
pnpm dlx create-astro astro-vanilla-repro --template minimal --yes --no-git --install
cd /tmp/astro-vanilla-repro
pnpm build
Expected behavior
The build should pass. Reading result.metafile inside an esbuild onEnd callback should return undefined when no metafile is available.
Actual behavior
The Vite+ Astro build fails with:
Not implemented
.../@voidzero-dev/vite-plus-core@0.1.20.../dist/vite/node/chunks/node.js:39404:11
The failing code path maps to packages/vite/src/node/optimizer/pluginConverter.ts, where convertEsbuildPluginToRolldownPlugin() creates this object in generateBundle():
const buildResult = new Proxy(
{},
{
get(_target, _prop) {
throw new Error('Not implemented')
},
},
) as esbuild.BuildResult
Astro's astro:dev-toolbar plugin registers an esbuild onEnd callback that does:
if (!result.metafile) return
That property read throws before Astro can return.
Suggested fix
Pass a minimal valid esbuild.BuildResult instead of a throwing proxy, for example with empty errors and warnings and optional result fields set to undefined.
System Info
System:
OS: macOS 26.4.1
CPU: (12) arm64 Apple M4 Pro
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.15.0
npm: 11.12.1
pnpm: 10.33.2
npmPackages:
vite: workspace:* => 8.0.10
rolldown: 1.0.0-rc.17
rollup: ^4.59.0 => 4.60.2
Package manager
pnpm
Validations
- I read the contributing guidelines.
- I checked for existing issues with
convertEsbuildPluginToRolldownPlugin, astro:strip-toolbar-sourcemap, and the Vite+ Not implemented error.
- This is a concrete Vite optimizer compatibility bug.
- The reproduction is minimal command-line reproduction.
Describe the bug
When an esbuild plugin registered through
optimizeDeps.esbuildOptions.pluginsusesbuild.onEnd, Vite's Rolldown compatibility converter passes aBuildResultproxy that throws for every property access.This breaks plugins that use normal esbuild behavior such as checking
result.metafile. With esbuild,result.metafileis simplyundefinedwhen no metafile is generated.I plan to submit a small PR for this.
Reproduction
No repo is needed. The following commands reproduce it with the current Vite+ package, which packages Vite's Rolldown-based optimizer path:
A plain Astro project succeeds:
Expected behavior
The build should pass. Reading
result.metafileinside an esbuildonEndcallback should returnundefinedwhen no metafile is available.Actual behavior
The Vite+ Astro build fails with:
The failing code path maps to
packages/vite/src/node/optimizer/pluginConverter.ts, whereconvertEsbuildPluginToRolldownPlugin()creates this object ingenerateBundle():Astro's
astro:dev-toolbarplugin registers an esbuildonEndcallback that does:That property read throws before Astro can return.
Suggested fix
Pass a minimal valid
esbuild.BuildResultinstead of a throwing proxy, for example with emptyerrorsandwarningsand optional result fields set toundefined.System Info
Package manager
pnpm
Validations
convertEsbuildPluginToRolldownPlugin,astro:strip-toolbar-sourcemap, and the Vite+Not implementederror.