.svelte resolution, loader setup, and Svelte client aliases automatically.
When Svelte is a good fit
- You want a smaller runtime for popup, options, sidebar, or new-tab UIs.
- You prefer component-first authoring with concise syntax.
- You want a framework option that works for both extension pages and content-script UI mounts.
Template examples
new-svelte

content-svelte

Usage with an existing extension
Install Svelte: For explicit setup in an existing project, install the Svelte loader too:Development behavior
When Extension.js detects Svelte, it:- Enables
.sveltefile resolution. - Configures the Svelte loader in the JS framework pipeline.
- Applies Svelte client aliases (for example,
svelte,svelte/store, andsvelte/reactivity).
Usage examples
In an extension page
In a content_script file
For content scripts, create a mount node and return a cleanup function from your default export. This lets Extension.js remount safely in development:
Best practices
- Keep Svelte components focused on UI and move browser API orchestration to dedicated modules.
- In content scripts, always return cleanup so remount behavior stays predictable.
- Use Svelte for extension pages first, then expand to content-script UI once the feature boundary is clear.
Next steps
- Learn more about TypeScript support.
- Review the content-script contract in Content scripts.

