If content script has imports, it doesn't work on external websites

I wrote simple content-script that prints “Hello!” when any page load:

window.addEventListener("load", function() {
    console.log("Hello!"); //Successfully 
});

And it works fine until I declare imports:

import * as Thing from './thing.js';

window.addEventListener("load", function() {
    console.log("Hello!"); //Now it's broken
});

In my manifest I have

"content_scripts": [
{
    "matches": ["<all_urls>"],
    "js": ["kbd-navigation.js"]
}]

Is it allowed to use imports in content-scripts? How to?

Content scripts are not loaded as es modules, thus import is not directly available. You’d have to use pre-processing to transform that to something that works in normal JS.