A minimal boilerplate for developing Chrome extensions with Svelte and Vite.
svelte-chrome-extension-boilerplate/
āāā public/ # Static files
ā āāā assets/ # Icons and assets
ā āāā manifest.json # Extension manifest
āāā src/
ā āāā popup/ # Popup UI
ā ā āāā popup.html
ā ā āāā popup.js
ā ā āāā Popup.svelte
ā āāā newtab/ # New Tab page
ā ā āāā index.html
ā ā āāā index.js
ā ā āāā index.css
ā ā āāā NewTab.svelte
ā āāā background/ # Background script
ā ā āāā background.js
ā āāā content_scripts/ # Content scripts
ā āāā content.js
ā āāā content.css
āāā vite.config.js # Vite configuration
# Clone the repo (or download)
git clone https://github.com/your-username/svelte-chrome-extension-boilerplate.git
# Install dependencies
npm install
# Start development server
npm run dev
# For popup development specifically
npm run dev:popup
# For new tab page development specifically
npm run dev:newtab
# Build the extension
npm run build
This creates a dist
folder with the following structure:
dist/
āāā popup/ # Popup UI files
āāā newtab/ # New tab page files
āāā background/ # Background script
āāā content_scripts/ # Content scripts
āāā shared/ # Shared chunks
āāā assets/ # Icons and assets
āāā manifest.json # Extension manifest
npm run build
chrome://extensions
dist
folderThis boilerplate comes with minimal implementations for all extension components. You can:
src/popup/Popup.svelte
for the popup UIsrc/newtab/NewTab.svelte
for the new tab pagesrc/background/background.js
for background functionalitysrc/content_scripts/content.js
for page interactionMIT