I'm trying to use ES6 module imports in a Safari Web Extension, but despite enabling "type": "module" in the manifest, imports are not functioning as expected.
Specifically when working with a project structure that includes multiple directories.
A root directory containing the manifest.json and main entry point scripts
A scripts/ folder housing core functionality modules
A common/ directory for shared utilities, constants, and helper functions
A background.js file in the root that attempts to import from these various directories
When trying to import modules from the scripts/ and common/ directories into my background.js, I'm encountering complete import failures.
How can I correctly implement cross-directory module imports in Safari Web Extensions?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Since Safari requires a macOS app as a container for Web Extensions, is there a way to establish native messaging directly from SafariWebExtensionHandler using stdin/stdout? Or does Safari enforce a different communication mechanism?
I’d like to keep the same approach as other browsers.
Any guidance on making this work would be appreciated!