nitro icon indicating copy to clipboard operation
nitro copied to clipboard

using `vite-plugin-legacy` with `nitro` breaks build

Open tolu opened this issue 2 months ago • 0 comments

Environment

Nitro: npm:nitro-nightly@latest Node: 22.20.0 @vitejs/[email protected]

Reproduction

https://github.com/tolu/nitro-vite-legacy-bug

Created via npx create-nitro-app and selecting Full stack with vite

Describe the bug

Not entirely sure why but using @vitejs/plugin-legacy with nitro in vite leads to this error (order of plugins does not seem to matter):

error during build:
[vite:build-html] No corresponding legacy entry chunk found for <repo-root>/index.html

From: plugin-legacy/src/index.ts#L721

I'm assuming that it might have something to do with that @vitejs/plugin-legacy runs transformIndexHtml on enforce: 'post', or that nitro is doing something to the config that in turn results in that transformIndexHtml is not called with a legacy chunk and so throws this error.

Additional context

No response

Logs


tolu avatar Oct 28 '25 20:10 tolu