Importmaps

It seems to me that extension pages don’t yet work with importmaps,
despite Firefox itself supporting it, is this an error on my side?

The popup.html

<script type = 'importmap'>
  {
    "imports" : {
      "StringColor" : "../STL/Visual/StringColor.js"
    }
  }
</script>
<script type = 'module' src = '../Scripts/Popup/App.js' defer></script>

App.js

import { hexFrom } from 'StringColor'

Considering that it’s giving me the

Uncaught TypeError: Error resolving module specifier “StringColor”. Relative module specifiers must start with “./”, “../” or “/”.

error message, it doesn’t seem to even acknowledge the importmap …

Check if dom.importMaps.enabled is turned on in your Firefox.
It’s turned on by default in Firefox 108.

1 Like

Ahhh yes, I’m currently still on 106 and 107
is the latest release if I see that correctly?

108 seems to be in Beta?

You can enable it in about:config. The pref name is “dom.importMaps.enabled”.

I know I know, I just wanted to confirm that the latest stable release isn’t yet 108.

Thank you for the answer, tested in and it seems to work fine.

I just wanted to confirm that the latest stable release isn’t yet 108.

Yes, Firefox 108 is still in Beta as of today.

1 Like