Loading topic
import declarations and the module graph they produce.2 min readimport/export syntax, have used async/await, and have run JavaScript in a browser page or with Node.js. Before you use import() or top-level await, you need to know whether the runtime treats your file as an ES module. That decision controls which syntax is al2 min readimport and export syntax, can read code that uses promises and async/await, and have run ES modules in a browser or in Node.js.2 min readimport/export syntax, promises with async/await, and the basic form of import() from the previous chapter. Here the focus is on what the promise resolves to: the module namespace object.2 min readimport() returns a promise for a module namespace object, and that you are comfortable with async/await and event listeners. Here you will apply import() to two common jobs. Lazy loading delays a module until the user needs it. Conditional loading fetches a 2 min readimport() returns a promise for a module namespace object, and that you are comfortable with async/await and try/catch. A dynamic import can fail like any other network or runtime operation. This chapter covers the ways it fails and how to recover.2 min readimport() returns a promise for a module namespace object, and that you are comfortable with Promise.all and async/await. It shows how to load several modules without making each one wait for the one before it.2 min readimport syntax, the basic import() expression, and how to run ES modules in a browser or Node.js. It covers the string you pass to import(), called the specifier: what forms it can take, how the runtime turns it into a real URL or file, and what changes 2 min readimport() returns a promise for a module namespace object, and how computed specifiers resolve. You should also have used a bundler such as webpack, Vite, Rollup, or esbuild at least once.3 min readimport/export syntax, can write async functions with await, and know how to make a file run as a module (type="module" in browsers, .mjs or "type": "module" in Node.js).3 min readimport/export syntax, promises, and how to run ES modules in Node.js (.mjs files or "type": "module"). It also assumes you have read the previous chapter on top-level await. The goal here is to predict the order in which modules run once some of them cont2 min readasync/await, and the import() expression. You should also know that top-level await pauses a module's evaluation and holds back every module that imports it. The patterns below use that pause on purpose. Each one finishes asynchronous setup befor2 min readasync/await, and how Node.js decides whether a file is CommonJS or an ES module (.cjs, .mjs, and the type field in package.json). That last topic was covered earlier in this tutorial.2 min readimport() returns a promise for a module namespace object, how default exports appear on that object, and how to handle a rejected import with try/catch. Here you will add one more piece: the optional second argument to import(), which carries **import attrib2 min read