I looked how one may use a background script es a new ES6 module. However, it seems to be very hard to easily do this.
Usually you embed it like this.
“background”: {
“script”: [ “background.js” ]
}
However, with a ES6 module, this does not seem to work, because usually (e.g. when you embed it in a HTML you have to ad the attribute type="module"
. In a manifest.json
this does not seem possible…
So the problem has been discussed in this article and there a simple workaround has been suggested:
Just include a HTML file instead of (only) a JS file in the manifest.json
:
“background”: {
“page”: “background.html”
}
However, this is of course not very nice and still a workaround.
- If nobody else comes up with some idea, I guess it is not implemented in Firefox. I’d open a Bugzilla issue then.
- Also, as for current actions, it should be documented on MDN, that this is not really possible. (and maybe document the workaround)