Can I use ES6 Modules in a WebExtension without webpack or similar?

I want to import a file from another file and I want to do it with plain old JS. Here is the error I’m getting


And here is the code https://github.com/andreicristianpetcu/google_translate_this/tree/es6_modules

Just execute ./run_desktop.sh to run it locally.

What am I doing wrong?

You have to load background.js as type=“module”. So you need a HTML page instead of directly pointing to the js file in the manifest.

2 Likes

Yes, see the same problem here:

1 Like