Using imports


(John Leicht) #1

When I upload an addon update to Firefox - as I have done before - all my files with module “imports” are rejected.

They test out OKAY in Firefox 61 (I’m not using developer or nightly). Do you know why the javascript modules might be rejected? Is it because I’m not using the .mjs extension in the filename? (I’m using .js)


Introduction to Add-on Development
(Jorge) #2

As far as I know ES6 imports are not supported in extension code at the moment.


(Martin Giger) #3

They are, see https://bugzilla.mozilla.org/show_bug.cgi?id=1394303 for context, but essentially you can use <script type="module"> in HTML to load your scripts as ES modules. I am not quite sure what versions this works in, though I guess it should be fine since Firefox 60.


(rugk) #4

Indeed, they should work, just some thing may not be optimal yet, such as this one: