wxt-dev / wxt

⚡ Next-gen Web Extension Framework
https://wxt.dev
MIT License
4.67k stars 202 forks source link

Vite 6: Explore possible improvements #1214

Open aklinker1 opened 2 days ago

aklinker1 commented 2 days ago

Feature Request

Two parts:

Is your feature request related to a bug?

N/A

What are the alternatives?

N/A

Additional context

https://vite.dev/blog/announcing-vite6.html

aklinker1 commented 2 days ago

Wrote a simple test to see how to use the environment APIs to build multiple bundles at once. The API is much nicer to use but performance wise, vite.createBuilder(...).buildApp() negligibly faster than just running vite.build(...) multiple times with different config (what WXT does). Hard to test on a real extension without actually implementing it in WXT... so we'll have to do that to benchmark it against a real extension with lots of dependencies.

vite-6-demo.zip

Did not profile memory usage nor did I look into changes to dev mode or importing TS files, so still some work to do.

eMerzh commented 1 day ago

Hello,

not sure you had that in your radar, but we were prompted with vite6 dep update, and it seems that the vite (https://wxt.dev/guide/essentials/config/vite.html) method to define the config isn't really type compatible anymore.

properties like resolve alias & plugins 🤔

aklinker1 commented 1 day ago

@eMerzh You probably have multiple versions of Vite installed. Type errors like this are usually a sign of this. I just released a new version of WXT that adds support for Vite 6: v0.19.17

Update WXT, then delete your lockfile or run pnpm i vite@latest && pnpm rm vite to update vite. Then run pnpm why vite again to make sure there's only one version installed in the project. If you use a different package manager... there are similar commands, but I don't know them off the top of my head.

eMerzh commented 23 hours ago

awesome @aklinker1 it makes the trick 💪 thanks