re: We reduced our vendor.js from 210kb to 16kb in about five minutes of work and ten lines of code VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Yes, looks like it (async () => { const moduleSpecifier = './utils.mjs'; const module = await import(moduleSpecifier) module.de...
 

I presume you could do something like this?

const moduleImport = async (loc, callback) => {
  const module = await import(loc);
  callback(module);
}

moduleImport("./dog", ({ bark }) => { bark("Hello World") });

How is this better than just using a promise, as shown in the post?

code of conduct - report abuse