Top-level await holds the importer
config.mjs awaits a timer at the top level. main.mjs imports it.
main.mjs
import { config } from './config.mjs';console.log('main runs with ' + config);config.mjs 4 lines
console.log('config: loading');await new Promise((r) => setTimeout(r, 20));export const config = 'ready';console.log('config: done');1. Predict the output
Tap the lines in the order you think they print.
- 1…
- 2…
- 3…