DEV Community

Discussion on: Writing Chrome Extensions Using Svelte-Kit and Manifest v3

Collapse
 
matyanson profile image
Matyanson • Edited

Thanks, your post was helpful!
Just one thing I'd like to add. When you build the app and select the build folder in the extension manager, chrome has problem with the file naming:
"Cannot load extension with file or directory name _app. Filenames starting with "_" are reserved for use by the system."
I fixed that by changing the appDir property in the svelte.config.js:

extension_fix

Collapse
 
matyanson profile image
Matyanson

I tried using the "webextension-polyfill" library for cross browser compability.
It seems it is not compatible with the "sveltekit-adapter-chrome-extension" adapter.
The following error message is thrown while building at "Using sveltekit-adapter-chrome-extension" step:
"[Error: This script should only be loaded in a browser extension.]"

Perhaps I could hot fix it, but I'll stick with the chrome API for now.
Is this even necessary now when the manifest v3 is out?(for cross browser compability)

Collapse
 
michmich112 profile image
Michel Canta

I have not use the "webextension-polyfill" library but that would be interesting. I'll check it out!

Collapse
 
michmich112 profile image
Michel Canta

Yes! thank you for trying it out and noting this out!
I had to do this as well and forgot to add it to this tutorial, I will add it right away!

Collapse
 
matyanson profile image
Matyanson

Here is a template I made, hope it helps.
github.com/Matyanson/SvelteKit-bro...

Collapse
 
michmich112 profile image
Michel Canta

This is Awesome! Definitely much cleaner than what I was working with before! Starred💫