Jump to navigation

Statements & declarations

Dynamic Imports

Tools like Webpack allowed us to import files as we need them. ES2020 now gives us the ability to do this natively.

// returns a promise
import('/modules/some-module.js')
.then((module) => {

});

// Or use await
async function LoadIt() {
const { app } = await import("./app.js");
app();
}