Skip to content

docs: Add missing breaking change to 0.20 migration #1636

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 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docs/guide/resources/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,20 @@ See https://github.com/wxt-dev/wxt/issues/784

To upgrade, you have two options:

1. **Stop using the polyfill** - No changes necessary, though you may want to do some manual testing to make sure everything continues to work. None of the early testers of this feature reported any runtime issues once they stopped using the polyfill.
- If you're already using `extensionApi: "chrome"`, then you don't need to test anything! You're already using the same `browser` object v0.20 provides by default.
1. **Stop using the polyfill**
- If you're already using `extensionApi: "chrome"`, then you're not using the polyfill and there is nothing to change!
- Otherwise there is only one change: `browser.runtime.onMessage` no longer supports using promises to return a response:
```ts
browser.runtime.onMessage.addListener(async () => { // [!code --]
const res = await someAsyncWork(); // [!code --]
return res; // [!code --]
browser.runtime.onMessage.addListener(async (_message, _sender, sendResponse) => { // [!code ++]
someAsyncWork().then((res) => { // [!code ++]
sendResponse(res); // [!code ++]
}); // [!code ++]
return true; // [!code ++]
});
```
2. **Continue using the polyfill** - If you want to keep using the polyfill, you can! One less thing to worry about during this upgrade.
- Install `webextension-polyfill` and WXT's [new polyfill module](https://www.npmjs.com/package/@wxt-dev/webextension-polyfill):
```sh
Expand Down