Somehow my answer got turned into a comment...
I believe this relates to your problem: Access imported functions from evaled code
Here is the annotation to the eval()
function from the MDN documentation:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#script
"It will be parsed as a script, so import declarations (which can only exist in modules) are not allowed."