A Vite powered WebExtension (Chrome, FireFox, etc.) starter template.
- CRXJS Vite Plugin Build a Chrome Extension with Vite
- HMR for extension pages and content scripts
- Vue 3 - Composition API,
Script setup
and more! - Vue Router setup incuding
vite-plugin-pages
for automatic route registration - Effortless communications - powered by
webext-bridge
and VueUse storage - Components auto importing
- Icons - Access to icons from any iconset directly
- TypeScript - type safe
Eslint
&Prettier
configured forvue
,javascript
,typescript
webext-bridge
- effortlessly communication between contextswebextension-polyfill
- A lightweight polyfill library for Promise-based WebExtension APIs in Chrome
vite-plugin-pages
- File system based route generator for Viteunplugin-auto-import
- Directly usebrowser
and Vue Composition API without importingunplugin-vue-components
- components auto importunplugin-icons
- icons as components- Material Design Icons - Material Design Icons
- VueUse - collection of useful composition APIs
- tailwindcss - A utility-first CSS framework
- Use Composition API with
<script setup>
SFC syntax
Create a repo from this template on GitHub.
If you prefer to do it manually with the cleaner git history
If you don't have pnpm installed, run: npm install -g pnpm
npx degit antfu/vitesse-webext my-webext
cd my-webext
pnpm i
src
- main source.content-script
- scripts and components to be injected ascontent_script
background
- scripts for background.popup
- popup pagesoptions
- options pagescomponents
- auto-imported Vue components that are shared in popup and options page.assets
- assets used in Vue components
dist
- built files, also serve stub entry for Vite on development.
pnpm dev
Then load extension in browser with the extension/
folder.
To build the extension, run
pnpm build
And then pack files under extension
, you can upload extension.crx
or extension.xpi
to appropriate extension store.
This template is heavenly inspired by: https://github.com/antfu/vitesse-webext