Adapter for SvelteKit which turns your app into a cross-platform browser extension.
Install with npm i -D sveltekit-adapter-browser-extension
, then add the adapter to your svelte.config.js
, and set the appDir to something without an underscore:
// svelte.config.js
import adapter from 'sveltekit-adapter-browser-extension';
export default {
kit: {
adapter: adapter(),
appDir: 'ext' // This is important - chrome extensions can't handle the default _app directory name.
}
};
An example barebone app exists at ./example-app
. You can npm run build
here and install the extension.
Install the adapter and npm run build
. Go to your browser's extension page and install unpacked extension - point it at the build directory within your app.
If you get an error about _app
being a disallowed folder, delete _app
from within the build dir. It appears there sometimes and I'm not sure why - I'll fix as soon as possible!
To specify your own manifest information (it will be merged with the generated one), simply have a manifest file local within your app directory.
I am looking for help to build and maintain this module. Roadmap is:
- Specifying the type of extension via config
- Allowing icons and such to be driven by configuration