wxt-dev/wxt

@types/webextension-polyfill breaks firefox mv3 builds

Closed this issue · 2 comments

Describe the bug

It's possible I missed this in the documentation somewhere, but I just tried to build my firefox extension for manifest v3 and realized that the built extension was still converting browser.action to browser.browserAction. Once I switched to @types/chrome, the built background.js no longer used browserAction, solving my issue.

If nothing else, even if this gets insta-closed, hopefully this will make it more searchable for future users.

Reproduction

browserAction-issue.zip (contains builds from both versions)

Steps to reproduce

Run wxt build -b firefox while using @types/webextension-polyfill.

System Info

System:
  OS: Linux 6.9 Pop!_OS 22.04 LTS
  CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1260P
  Memory: 35.42 GB / 62.51 GB
  Container: Yes
  Shell: 5.1.16 - /bin/bash
Binaries:
  Node: 20.12.0 - ~/.nvm/versions/node/v20.12.0/bin/node
  npm: 10.5.0 - ~/.nvm/versions/node/v20.12.0/bin/npm
  pnpm: 9.13.2 - ~/.local/share/pnpm/pnpm
npmPackages:
  wxt: ^0.19.13 => 0.19.16

Used Package Manager

pnpm

Validations

Hmm, looking at the files you provided, both have action in the manifest, not browser_action, so the manifest looks fine.

You said there was a problem with your background... just installing some type-only packages shouldn't have any effect on the build output. Did you also switch to extesionApi: 'chrome'?

Yeah, I was switching the extensionApi to match the typing library for some reason.