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
- ECMAScript modules — The standard JavaScript module system, written with import and export statements, used by browsers and modern tools.
- React.lazy — The React function that defines a component whose code is loaded with a dynamic import the first time it renders.
- chunk — One piece of a larger piece of data delivered by a stream.
Taught in
- Code-Splitting with React.lazy: Dynamic Imports And Chunks — React 19 & Modern Component Architecture