-
-
Notifications
You must be signed in to change notification settings - Fork 439
Open
Labels
pending-triageSomeone (usually a maintainer) needs to look into this to see if it's a bugSomeone (usually a maintainer) needs to look into this to see if it's a bug
Description
Describe the bug
If I use
const worker = new Worker(new URL("./worker.js", import.meta.url), {
type: "module",
});
worker.js will not be packaged.
This is the recommended way to package a Worker according to vite: https://v3.vitejs.dev/guide/features.html.
Reproduction
Steps to reproduce
pnpm install.
From the output, you can see that worker.js and sqlite3.wasm are not bundled.
The reason is that in defineImportMeta.mjs shipped by wxt, import.meta.url is replaced by self.location.href. This confused the bundler.
This seems to be related to #392. Personally, I don't think such substitution makes any sense on wxt level given such severe side effects, which confused vite's recommend pattern. If a user need this workaround for some packages, they may apply it themselves in their config. Once applied, it is hard to find and remove this define.
System Info
System:
OS: Linux 6.18 EndeavourOS
CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
Memory: 84.63 GB / 125.73 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 22.21.1 - /home/yichaozhou/.nix-profile/bin/node
Yarn: 1.22.22 - /usr/bin/yarn
npm: 10.9.4 - /home/yichaozhou/.nix-profile/bin/npm
pnpm: 10.25.0 - /usr/bin/pnpm
Browsers:
Firefox: 146.0.1
Firefox Developer Edition: 146.0.1
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.
Metadata
Metadata
Assignees
Labels
pending-triageSomeone (usually a maintainer) needs to look into this to see if it's a bugSomeone (usually a maintainer) needs to look into this to see if it's a bug