You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
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.
@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.
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.
Activity
aklinker1 commentedon Mar 8, 2025
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 inzip.includeSourcesandzip.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.
st3h3n commentedon Mar 9, 2025
I don't use local packages.
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.
aklinker1 commentedon Apr 21, 2025
@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.includeSourcesandzip.excludeSourcesoptions.ninadsutrave commentedon Oct 18, 2026
PR is up: #2675. It uses Vite's module graph behind
experimental.autoIncludeSourcesand adds e2e tests that rebuild the extension from the extracted sources.