Skip to content

Automatic gathering of used files for zip #1505

Description

@st3h3n

Feature Request

I added the extension as a child to another project, kind of like a monorepo. The problem is that when I zip for Firefox it only includes the source files for the extension, but not files that the extension imports from the parent (or sibling) project. A possible way to do this might be; since Vite/Rollup should be aware of which files actually end up in the compiled output, zip could follow the paths and add those files.

Is your feature request related to a bug?

"N/A"

What are the alternatives?

Adding the files manually via defineConfig({ zip: {} }) which is very tedious and doesn't scale.

Additional context

"N/A"

Activity

  1. aklinker1 commented on Mar 8, 2025

    @aklinker1
    Member

    If you're using a "package based" momorepo, not an integrated monorepo, vite is not aware of the sources of other local packages your extension depends on, only the already transpiled files of those packages. So no, there is no way for WXT to guarantee it will find all the files it needs.

    You will have to tell it which files to zip. Config for controlling the root directory that is zipped already exists: zip.sourcesRoot. Then you can use glob patterns in zip.includeSources and zip.excludeSources.

    Here's an example from a old version of WXT: https://github.com/anime-skip/player/blob/main/apps/extension/wxt.config.ts


    Or, if you know vite is able to detect all the source files correctly in your project, you can dynamically generate the list yourself by hooking into the build process and changing which files get zipped. This can be done in a WXT module.

  2. st3h3n commented on Mar 9, 2025

    @st3h3n
    ContributorAuthor

    I don't use local packages.

    if you know vite is able to detect all the source files correctly in your project, you can dynamically generate the list yourself by hooking into the build process and changing which files get zipped. This can be done in a WXT module.

    Exactly. That's what I'm proposing for WXT to support natively. This wouldn't just help people with (integrated) monorepos, but it would also save people from having to manually delete all the files the don't need in the zipped source code.

  3. aklinker1 commented on Apr 21, 2025

    @aklinker1
    Member

    @st3h3n yeah, that makes sense, I'm down to add it!

    We should start by adding an experimental flag to enable this feature, and when enabled or ignores the zip.includeSources and zip.excludeSources options.

  4. added
    good first issue
    on Apr 21, 2025
  5. added this to the v1.0 milestone on Apr 21, 2025
  6. modified the milestones: v1.0, v1.1 on Feb 7, 2026
  7. ninadsutrave commented on Oct 18, 2026

    @ninadsutrave

    PR is up: #2675. It uses Vite's module graph behind experimental.autoIncludeSources and adds e2e tests that rebuild the extension from the extracted sources.

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

    contribution welcomegood first issue

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions