Repository navigation
Description
Happy to move this to a discussion if issues are not well suited, this might need some discussion
Feature Request
- Let the user specify its
vite,svelteor@sveltejs/vite-plugin-svelteversions in the project'spackage.jsoninstead of wrapping all underwxtor@wxt-dev/module-svelte. - Let the framework configs be separate, from the
wxt.config
// project-using-wxt package.json
{
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^7.0.0",
"svelte": "^5.0.0",
"vite": "^8.0.0",
"wxt": "^0.20.20"
}
}/project-using-wxt
/src
svelte.config.js
vite.config.ts
wxt.config.ts
wxt needs then to just specify the expected deps in peerDependencies:
{
"peerDependencies": {
"svelte": "^4.0.0 || ^5.0.0",
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
}and consume the relative framework's config
Looking at @wxt-dev/module-svelte, I guess that this kind of packages exist to have an unified config, but I'd argue that the tradeoff of a single config it's not worth the problems that it creates, specifically:
- some tools (like
svelte-check, the svelte typechecker) need to look at thesvelte.configfile to figure stuff, like if you have the async flag enabled, which they fail to if the conf are under thewxt.config.
I think wxt should support frameworks options and not viceversa. - in monorepo environments, the dependency tree of a
wxtproject might intersecate with the tree of others, leading to projects sharing dependencies version when the should not.
People may have very exotic constraints, e.g. when I updated another project in a monorepo to vite 8, that vite version get passed down the wxt project and its subdependencies as well, while i need it to stay fixed at vite 7.
Specifically the @wxt-dev/[email protected] gets stuck with @sveltejs/[email protected] which does not support vite 8, making pnpm complain.
I'd also argue that this change could allow wxt to be more framework agnostic, making it easier to use whatever framework with whatever combination of libraries.
Is your feature request related to a bug?
Look at the section above
What are the alternatives?
- I was not able to find a solution, i reverted back to not using async svelte;
- Overriding the dependencies, which feels like a maintainability burden.
How it might evolve
Perhaps this could also spark some bigger refactor to make the core wxt a thinner layer on top of vite, even a plugin like @sveltejs/kit is, while preserving the fantastic features and allow more extensibility in the future. Like extracting the cli in its own package invocable by npx,
I may be biased (I love svelte and sveltekit 😅) but i think the sveltekit way of handling its environment is the top notch experience.
I think that having the svelte's control and ergonomics with the nuxt's DX will make this the no-brainer framework for web extensions.
I'm not able to speak for other frameworks, but if you need some help to test svelte's edgecases I'm happy to help.
Activity
aklinker1 commentedon Apr 12, 2026
Peer dependencies
I've already done this in the
majorbranch! Well, except for the vite plugin. I can do those too.wxt/packages/wxt/package.json
Lines 62 to 66 in 4c78167
wxt/packages/module-svelte/package.json
Lines 45 to 51 in 4c78167
Details
wxt/packages/module-vue/package.json
Lines 45 to 50 in 4c78167
wxt/packages/module-solid/package.json
Lines 47 to 52 in 4c78167
wxt/packages/module-react/package.json
Lines 47 to 52 in 4c78167
No timeline for when that will be released, it will be v1.0, but here's the milestone: https://github.com/wxt-dev/wxt/milestone/2
aklinker1 commentedon Apr 12, 2026
Splitting config
Vite
I originally made the vite config apart of
wxt.config.tsbecause I don't like extra config files, and nuxt doesn't support that either. I still make lots of decisions to mirror the Nuxt team's decisions, it's worked out well in general.However, there is a technical reason why we need to keep vite inside
wxt.config.ts: WXT orchastrates multiple builds, and each build needs "new" instances of vite plugins. Vite plugins sometimes cache values in the global scope. That means if we were to use avite.config.tsfile, it's only imported once then that global cache is re-used and causes plugins to break in very vague and unpredictable ways.See #121, this is when I started requiring a function. Here's the line that disables reading from
vite.config.tsfiles:wxt/packages/wxt/src/core/builders/vite/index.ts
Line 49 in 5f799ca
Svelte
As for svelte,
the svelte devs notified meof some seg faults when using a config file. If that's fixed, we can remove this flag 🤷wxt/packages/module-svelte/src/index.ts
Lines 17 to 22 in 5f799ca
It's been a while since these bugs were fixed in WXT, maybe they're fixed now in the upstream repos as well? Feel free to patch the package to allow reading from config files
aklinker1 commentedon Jul 26, 2026
OK, I haven't decided whether to make the vite plugins peers - it's nice to only have to install one package when setting up the framework, but it sucks to have to upgrade sub-dependencies when new major versions are released... I wished there was some way to handle both, but AFAIK, we have to pick one of those options.
Edit: Maybe you can do both? As long as the version range is loose, like
@vitejs/plugin-vue@>=5, anyone can specify their own version in their project and it will be respected.But the other peer work and breaking changes to
wxtare in #2447, so we're good for the next major version.We should still:
configFile: falsefrom svelte and allow people to use external file if they want