Template for creating a WebExtension using Bun.
- Bun features/plugins support
- TypeScript building
browserandchromeAPIs supportchromeAPI polyfill- Prettier configuration
- Clone the repository:
git clone https://github.com/Bellisario/bun-webextension.git mywebextension && cd mywebextension && rm -rf .git
- Install dependencies:
bun install
- Run the dev build (will rebuild on changes):
bun run dev
- Load the extension in your browser:
- For Chrome: Go to
chrome://extensions, enable "Developer mode", and load the unpacked extension from thedistdirectory. - For Firefox: Go to
about:debugging#/runtime/this-firefox, click "Load Temporary Add-on", and select themanifest.jsonfile from thedistdirectory.
- For Chrome: Go to
- When done with development, build the extension with:
The built extension will be in the
bun run build
distdirectory ready to be packed and distributed.
Currently hot reloading is not supported. The extension is automatically rebuilt on changes, but you still need to manually reload it in your browser to see the changes.
In the future hot reloading might be added by using a WebSocket connection and reload the extension by calling browser.runtime.reload(), but I'm unsure if this is possible with v3 manifest extensions.
If you have any ideas on how to implement hot reloading, open an issue or a pull request!
We ❤️ contributions!
Feel free to open an issue or a pull request but follow Contributing Guidelines.
If you don't know where to start, check out the help wanted issues!
This template is available under The Unlicense license.
You are free to do anything with this code and use this template removing the LICENSE file.
If you found this template useful, please consider citing it in your repo's README so others can discover it, too.