Installation
Bootstrap a new project, start from scratch, or migrate an existing project.
Bootstrap Project
Run the init
command, and follow the instructions.
sh
pnpm dlx wxt@latest init
sh
bunx wxt@latest init
sh
npx wxt@latest init
sh
# Use NPM initially, but select Yarn when prompted
npx wxt@latest init
Starter Templates:
All templates use TypeScript by default. To use JavaScript, change the file extensions.
Demo
Once you've run the dev
command, continue to Next Steps!
From Scratch
- Create a new projectsh
cd my-project pnpm init
shcd my-project bun init
shcd my-project npm init
shcd my-project yarn init
- Install WXT:sh
pnpm i -D wxt
shbun i -D wxt
shnpm i -D wxt
shyarn add --dev wxt
- Add an entrypoint,
my-project/entrypoints/background.ts
:tsexport default defineBackground(() => { console.log('Hello world!'); });
- Add scripts to your
package.json
:json{ "scripts": { "dev": "wxt", "dev:firefox": "wxt -b firefox", "build": "wxt build", "build:firefox": "wxt build -b firefox", "zip": "wxt zip", "zip:firefox": "wxt zip -b firefox", "postinstall": "wxt prepare" } }
- Run your extension in dev modeWXT will automatically open a browser window with your extension installed.sh
pnpm dev
shbun run dev
shnpm run dev
shyarn dev
Next Steps
- Keep reading on about WXT's Project Structure and other essential concepts to learn
- Configure automatic browser startup during dev mode
- Explore WXT's example library to see how to use specific APIs or perform common tasks