You can import ES6-style JavaScript modules dynamically using await import(filename);.

This works a bit differently from the regular import statement for "default exports". Apparently, you have to do this:

const {default: renamedDefaultExport, namedExport1, namedExport2} = await import("./mymodule.js");

This would be similar to the following:

import renamedDefaultExport, {namedExport1, namedExport2} from "./mymodule.js";
Previous on JavaScript
Mastodon Mastodon