Skip to content

Externalise framework dependecies and split configs #2236

Description

@loky-lp

Happy to move this to a discussion if issues are not well suited, this might need some discussion

Feature Request

  1. Let the user specify its vite, svelte or @sveltejs/vite-plugin-svelte versions in the project's package.json instead of wrapping all under wxt or @wxt-dev/module-svelte.
  2. 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:

  1. some tools (like svelte-check, the svelte typechecker) need to look at the svelte.config file to figure stuff, like if you have the async flag enabled, which they fail to if the conf are under the wxt.config.
    I think wxt should support frameworks options and not viceversa.
  2. in monorepo environments, the dependency tree of a wxt project 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?

  1. I was not able to find a solution, i reverted back to not using async svelte;
  2. 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

  1. added theissue type on Apr 7, 2026
  2. aklinker1 commented on Apr 12, 2026

    @aklinker1
    Member

    Peer dependencies

    I've already done this in the major branch! Well, except for the vite plugin. I can do those too.

    "peerDependencies": {
    "eslint": "^8.57.0 || ^9.0.0",
    "vite": "^6.3.4 || ^7.0.0",
    "web-ext": ">=9.2.0"
    },

    "peerDependencies": {
    "wxt": ">=0.18.6",
    "svelte": ">=5"
    },
    "dependencies": {
    "@sveltejs/vite-plugin-svelte": "^4.0.0 || ^5.0.0 || ^6.0.0"
    },

    Details

    "peerDependencies": {
    "wxt": ">=0.19.16"
    },
    "dependencies": {
    "@vitejs/plugin-vue": "^5.2.3 || ^6.0.0"
    },

    "peerDependencies": {
    "wxt": ">=0.19.16"
    },
    "dependencies": {
    "vite-plugin-solid": "^2.11.10"
    },

    "peerDependencies": {
    "wxt": ">=0.19.16"
    },
    "dependencies": {
    "@vitejs/plugin-react": "^4.4.1 || ^5.0.0"
    },

    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

  3. added this to the v1.0 milestone on Apr 12, 2026
  4. pinned and unpinned a comment on Apr 12, 2026
  5. aklinker1 commented on Apr 12, 2026

    @aklinker1
    Member

    Splitting config

    Vite

    I originally made the vite config apart of wxt.config.ts because 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 a vite.config.ts file, 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.ts files:

    config.configFile = false;

    Svelte

    As for svelte, the svelte devs notified me of some seg faults when using a config file. If that's fixed, we can remove this flag 🤷

    Edit: I appeared to find that myself in the original PR for adding svelte. Must have failed for a basic svelte extension without disabling the config file.

    svelte({
    // Using a svelte.config.js file causes a segmentation fault when importing the file
    configFile: false,
    preprocess: [vitePreprocess()],
    ...vite,
    }),


    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

  6. aklinker1 commented on Jul 26, 2026

    @aklinker1
    Member

    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 wxt are in #2447, so we're good for the next major version.

    We should still:

    • Make a decision on wither or not framework vite plugins should be peers to their wxt module packages
    • Remove configFile: false from svelte and allow people to use external file if they want
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions