tc39/proposal-module-expressions

Allow await inline modules?

alex-kinokon opened this issue · 2 comments

Specifically,

const i18n = await module {
  export function t(key) {
  }
}

Instead of having to create an intermediate variable.

You can already avoid the intermediate variable with

const i18n = await import(module {
  export function t(key) {
  }
});

(sure, it's one keyword longer, but it doesn't need a special syntax)

surma commented

Yeah, what @nicolo-ribaudo said. Being able to await the module itself to get an instance would create serious questions about the underlying types and have implications wrt module caching. I