Skip to content

feat: add experimental autoIncludeExternalSources option for monorepo support #1826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

johnnyfekete
Copy link
Contributor

@johnnyfekete johnnyfekete commented Jul 25, 2025

First real contribution here, hope I understood the issue correctly 🙂

Overview

Adds experimental autoIncludeExternalSources option to automatically include external source files in zip archives for monorepo setups.
When enabled, WXT analyzes the build output to find imported files from outside the extension directory and includes them in the sources zip. This eliminates the need for manual configuration when extensions import from parent/sibling packages.

The feature is disabled by default for backward compatibility and marked as experimental.

Manual Testing

  1. Create a shared file outside your extension: ../shared-lib/utils.ts
  2. Import it in your extension: import { util } from '../../../shared-lib/utils';
  3. Enable in config: zip: { autoIncludeExternalSources: true }
  4. Run wxt zip -b firefox
  5. Check sources zip contains the external file's contents

Related Issue

This PR closes #1505

Copy link

netlify bot commented Jul 25, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit d632e5c
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/688a0ac16ae90000089b4137
😎 Deploy Preview https://deploy-preview-1826--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@@ -200,6 +200,24 @@ Depending on your package manager, the `package.json` in the sources zip will be
WXT uses the command `npm pack <package-name>` to download the package. That means regardless of your package manager, you need to properly setup a `.npmrc` file. NPM and PNPM both respect `.npmrc` files, but Yarn and Bun have their own ways of authorizing private registries, so you'll need to add a `.npmrc` file.
:::

#### Include External Sources (Experimental)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, if this is the right place to add the documentation 🤷‍♂️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably fine.

@johnnyfekete johnnyfekete marked this pull request as ready for review July 30, 2025 12:13
Copy link
Member

@aklinker1 aklinker1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the idea, just need to see a better E2E test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests don't actually test the new behavior. Please actually include a external file in project, then extract and make sure the are included.

Here's an example of how to unzip and check for file existence: https://github.com/johnnyfekete/wxt/blob/d632e5c3cdd96421662b791c6d6008b32dde666e/packages/wxt/e2e/tests/zip.test.ts#L103-L123

@@ -200,6 +200,24 @@ Depending on your package manager, the `package.json` in the sources zip will be
WXT uses the command `npm pack <package-name>` to download the package. That means regardless of your package manager, you need to properly setup a `.npmrc` file. NPM and PNPM both respect `.npmrc` files, but Yarn and Bun have their own ways of authorizing private registries, so you'll need to add a `.npmrc` file.
:::

#### Include External Sources (Experimental)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatic gathering of used files for zip
2 participants