vavite icon indicating copy to clipboard operation
vavite copied to clipboard

Breaks with new Vite 6

Open giacomorebonato opened this issue 1 year ago • 5 comments

Looking into this issue

files generated
  dist/client/sw.js
  dist/client/workbox-4723e66c.js
error during build:
[vite:manifest] Cannot read properties of undefined (reading 'length')
    at Object.generateBundle (file:///Users/grebonato/Code/fastrat/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-BcnkIxro.js:13576:58)
    at Object.handler (file:///Users/grebonato/Code/fastrat/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-BcnkIxro.js:50852:15)
    at file:///Users/grebonato/Code/fastrat/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20812:40

https://github.com/giacomorebonato/fastrat/pull/838

giacomorebonato avatar Nov 27 '24 17:11 giacomorebonato

Hi!

I just upgraded the project to Vite 6 and the CI (which is pretty extensive) is green for me. I've also been using Rakkas with Vite 6 since the early beta days with no issues. I'm giving Rakkas as an example because it is in some ways similar to your project (which looks pretty cool, starred!), basically a metaframework that uses parts of vavite.

Are you sure the problem is related to vavite and not to some other component of your project? The attached error doesn't seem to come from vavite, for example.

In other words, I'm gonna have to give you the dreaded "I'll need a minimal repro to look into it" :)

cyco130 avatar Nov 30 '24 18:11 cyco130

==> /var/log/api/err1.log <==
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
4:24:35 PM [vite] Internal server error: createViteRuntime is not a function
      at file:///var/api/node_modules/@vavite/connect/dist/index.js:66:39
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

createViteRuntime was removed in v6: https://github.com/vitejs/vite/discussions/16358#discussioncomment-9872925

martinkruusement avatar Jan 12 '25 16:01 martinkruusement

The original issue from @giacomorebonato seems to be in vite-plugin-pwa actually, see here.

The missing createViteRuntime reported by @martinkruusement is a real Vite 6 compatibility issue when useViteRuntime is true:

https://github.com/cyco130/vavite/blob/8b7d7cc9563c6b3ca3ff5a6f27fabaaeb1495811/packages/reloader/src/index.ts#L86-L92

The experimental API has changed, from this Pull Request it is visible what have changed. But it seems there were more changes to the API - see documentation, the end result is different.

I just had a quick look at the repository and it seems that there are no tests for useViteRuntime=true @cyco130, so this “breaking” change (not breaking according to Vite devs, because of the experimental nature) went unnoticed.

oldium avatar Feb 10 '25 08:02 oldium

Thanks @oldium for finding that!

giacomorebonato avatar Feb 11 '25 14:02 giacomorebonato

@cyco130 is this project dead?

oldium avatar Mar 28 '25 21:03 oldium