Repository navigation
Closed
Labels
Description
Describe the bug
Setup
// wxt.config.ts
export default defineConfig({
zip: {
includeSources: ['entrypoints/**'],
},
})Repo tree:
entrypoints/foo.ts
entrypoints/bar.js
cache/secrets/abc
super-secret-file
.gitignore
Expected behavior
$ wxt zip:firefox
$ zipinfo .output/*sources.zip
entrypoints/foo.ts
entrypoints/bar.jsCurrent non-intuitive, dangerously leaky behavior
$ wxt zip:firefox
$ zipinfo .output/*sources.zip
entrypoints/foo.ts
entrypoints/bar.js
cache/secrets/abc
super-secret-fileHacky workaroud
I should not have to do this, but that's how I worked around this bug:
export default defineConfig({
zip: {
excludeSources: ['**'],
includeSources: ['entrypoints/**'],
},
})I'll point out that this usually not how an allowlist/denylist behaves. The "accepted", safe, intuitive behavior is the following:
- Nothing configured: default behavior, today "Hidden files, node_modules, and tests are ignored". I'd personally vote for a more advanced "respect .Xignore" support for a bunch of popular VCSes, like what ripgrep does, but that's a stretch.
- Only allowlist provided (include): takes precedence since the user went through the trouble of customizing this setting; only what's "included" is included; not what happens, and what this bug is about.
- Only denlist provided (exclude): takes precedence, everything is included except what's denied.
- Both allowlist & denylist provided: only what passes the allowlist, then filter out further according to denylist. Though I accept that the opposite (first denylist, then force-allowlist), which is WXT's current behavior ("[includeSources] overrides excludeSources; if a file matches both lists, it is included in the ZIP") is acceptable albeit annoying.
Pointers:
- https://wxt.dev/guide/essentials/publishing.html#firefox-addon-store
- https://wxt.dev/api/reference/wxt/interfaces/InlineConfig.html#zip
- Vaguely related: Automatic gathering of used files for
zip#1505
Reproduction
Steps to reproduce
$ mkdir /tmp/repro && cd /tmp/repro
$ unzip /tmp/repro.zip
$ npm install
$ npm run zip:firefox
$ zipinfo .output/*sources.zipSystem Info
System:
OS: Linux 6.18 cpe:/o:nixos:nixos:26.05 26.05 (Yarara)
CPU: irrelevant
Memory: irrelevant
Container: Yes
Shell: 5.3.9 - /bin/bash
Binaries:
Node: 24.13.0 - node
Yarn: 1.22.22 - yarn
npm: 11.6.2 - npm
pnpm: 10.28.0 - pnpm
npmPackages:
wxt: ^0.20.6 => 0.20.13Used Package Manager
pnpm
Validations
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Activity
aklinker1 commentedon Feb 11, 2026
I do not mention the defaults for those values, nor how they are merged. That's definitely part of the problem.
Gonna share the relevant lines of code here for reference:
How user config get's merged with the defaults
wxt/packages/wxt/src/core/resolve-config.ts
Lines 309 to 322 in 3417bd3
https://github.com/wxt-dev/wxt/blob/3417bd3ed27d2e52e6b906393e0329565256f0e7/packages/wxt/src/core/resolve-config.ts#L303C5-L303C24
The call to glob
wxt/packages/wxt/src/core/zip.ts
Lines 116 to 128 in 3417bd3
So basically all non-hidden files are included by default, unless you exclude it.
I have some cleanup to do here, like moving that
**/*into theresolve-config.tsfile so all the options are in one place.WXT tries to provide intelligent defaults that work for most projects, but clearly don't work in your case... so they might be too generic. I have fallen victim to this on one of my own projects, so there's definintely a DX problem here lol.
So you're recommending list the files they want to include, then let the exclude option remove files from that list? Basically don't have WXT do anything for you so you have complete control.
I think that makes sense. It will have to be a breaking change, will need to wait for the next major release.
aklinker1 commentedon Feb 11, 2026
@PatrykKuniczak you wanna take this bug? It's a breaking change, be sure to work off the
majorbranch.Edit: nevermind, @kaigritun already opened a PR lol
fix(zip): make includeSources use allowlist behavior
fix(zip): make includeSources use allowlist behavior
zopieux commentedon Feb 12, 2026
Thanks for taking action upon this suggestion!
Pretty much, yes. I don't mind the current default value for the blocklist though, which would be bullet point 3. If I say
include: dir/**butdircontains some hidden files, they'd be not included by virtue of the default exclude. User can customize the exclude list if they really want hidden files.The point I'm making is that with this conservative approach, the worst that can happen is that the Firefox review folks (if they still exist in 2026 Mozilla...) ask for missing source files, as opposed to random secrets being leaked.
Parth-Jadhav-2004 commentedon Oct 21, 2026
Saw #2111/#2114 got closed — mind if I pick this up on
major? Plan is to treat a user-provided includeSources as an explicit allowlist (no merging with the**/*default), keep the default excludes on top, and add zip tests for include-only, exclude-only and both.PatrykKuniczak commentedon Oct 23, 2026
I think it's question for @aklinker1 because he's familiar with this issue.
PatrykKuniczak commentedon Oct 23, 2026
But this issue i think is solved already.
@Parth-Jadhav-2004 If Aaron approve your request, let's open new issue about that.
aklinker1 commentedon Oct 25, 2026
This is how it works already as of v0.21. If it isn't behaving that way, or you want it to behave another way, let's open a new issue to discuss it.