Dynamic module imports is empty when inside Docker

When I use await import(module) inside Docker the module is just an empty object. Outside of docker everything works as intended.

Node: v16.13.1
Docker: Docker version 20.10.7, build f0df350
Image: node:16

The Code:

import path from "path";

export const WorkerLoader = async () => {
    // import Worker from the public directory => copied from docker
    const here = "file://" + path.resolve("./worker/worker.js"); // worker.wasm.js & worker.wasm don't work in node
    const WorkerModule = await import(here);

    WorkerModule().then(callback); // no, its not a promise
}

If I log WorkerModule I get [Module: null prototype] { }. I’ve also tried to do it with WorkerModule.default but this is undefined.

I can’t just simply change the code to a normal import because it need those exact functions to be present due to a shared code basis for web and nodejs, where I use module-alias to make my own implementations of modules, that were designed for the web.

Edit:
The worker.js file has at the end

if (typeof exports === 'object' && typeof module === 'object')
  module.exports = Worker;
else if (typeof define === 'function' && define['amd'])
  define([], function() { return Worker; });
else if (typeof exports === 'object')
  exports["Worker"] = Worker;