dynamic import

The import() expression that loads a JavaScript module at run time and returns a promise for it.

In more detail

Bundlers turn each dynamic import into a separate chunk file. Because it returns a promise, code can wait for it only when the module is actually needed.

Example

React.lazy expects a function returning such a promise whose module has a default export that is a component.

Related terms

Taught in

References