Import ES Modules in Content Script. Is it possible?

I'm porting a web extension from Chrome to Safari, and I need to execute a method as a content script that is part of an ES module (in particular its default export).

In Chrome I use following snippet (via Stack Overflow)

const results = await chrome.scripting.executeScript({
  args: ["/js/content_script/main.js"],
  func: async (path) => {
    const src = chrome.runtime.getURL(path);
    const { default: asyncMain } = await import(src);

    return asyncMain();
  }
});

In Safari this seems to either not work, cause the Web Extension Background Context window to close, or crash the browser.

Am I doing something wrong, or is this not possible?

Import ES Modules in Content Script. Is it possible?
 
 
Q