Skip to content

Exclude files in .zip except those with a bang ! #1510

Closed
@skube

Description

@skube

Describe the bug

Asking the AI bot about excluding files from zip, I got these instructions:

To exclude all JSON files except manifest.json from the zip, you can configure the zip.exclude option in your wxt.config.ts file as follows:

// wxt.config.ts
import { defineConfig } from 'wxt';

export default defineConfig({
  zip: {
    exclude: [
      '**/*.json',       // Exclude all .json files
      '!manifest.json',  // Include manifest.json
    ],
  },
});

Here's how this configuration works:

    '**/*.json' excludes all files with the .json extension in any directory.
    '!manifest.json' is a negative pattern that includes manifest.json, overriding the previous exclusion.

Make sure that the paths specified in the exclude array are relative to the root of the WXT project.

However, the bang(!) seems to cause some weirdness when trying to open the produced zip file.

Not sure if I'm doing something wrong, or if there is a bug?

Reproduction

https://github.com/skube/min-repro-wxt

Steps to reproduce

Steps:

  1. npm i
  2. npm run zip
  3. Try to open .zip created in .output/

System Info

System:
    OS: macOS 15.3.1
    CPU: (8) arm64 Apple M2
    Memory: 107.06 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.11.1/bin/yarn
    npm: 10.9.2 - ~/.nvm/versions/node/v20.11.1/bin/npm
    pnpm: 9.12.2 - ~/.nvm/versions/node/v20.11.1/bin/pnpm
    bun: 1.2.2 - ~/.bun/bin/bun
  Browsers:
    Chrome: 133.0.6943.142
    Edge: 118.0.2088.76
    Safari: 18.3
  npmPackages:
    wxt: ^0.19.29 => 0.19.29

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending-triageSomeone (usually a maintainer) needs to look into this to see if it's a bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions