According to the documentation, module support is only on preliminary stages at the moment, so you probably shouldnāt be using it for extension code.
You can load scripts the same way you do on websites (using <script src="..."> tags).
You can of cause use a module loader (require.js, webpack, ā¦) that does that for you.
Some other words:
I got the same error message and found this post. To be fair, the error message does not make sense, as I appear to be importing at the top level of a module. I also got a similar error for the export statements at some point while trying different methods to fix this. Luckily, this all got fixed for me at least. (Thanks to the inspiration from this PR.)