Stability: 1 - Experimental

    The await keyword may be used in the top level (outside of async functions) within modules as per the [ECMAScript Top-Level await proposal][].

    Assuming an a.mjs with

    1. export const five = await Promise.resolve(5);

    And a b.mjs with

    1. import { five } from './a.mjs';
    2. console.log(five); // Logs `5`
    1. node b.mjs # works