Dynamic import
Dynamic import is a language feature that asynchronously loads a module at runtime and returns a promise for its module namespace.
React Hooks in Action: With Suspense and Concurrent Mode
A dynamic import is a JavaScript import expression that asynchronously loads a module at runtime and returns a promise for its module namespace.
- How it is used
- Defers loading less frequently used or bulky application code until a route visit or user interaction requires it.
- How deep it goes
- Explains import() promises, module export properties, promise handlers, and async/await, then connects dynamic imports to React.lazy.
- Examples
- Demonstrates a button-triggered helloModule load that calls default and named exports, then adapts the pattern for a lazy Calendar component.
- What you can do after
- Apply it via the import function to load modules on demand and consume their default or named exports asynchronously.
Read how React Hooks in Action: With Suspense and Concurrent Mode explains dynamic import →
Secrets of the JavaScript Ninja, Third Edition
Dynamic import is an expression that loads a module at runtime and returns a promise for its module namespace object.
- How it is used
- Loads a module only when needed, avoiding eager parsing of unused package code.
- How deep it goes
- Explains runtime versus parse-time resolution and demonstrates deferred loading, but does not detail loading internals.
- Examples
- Demonstrates awaiting a turtle submodule import inside a package-root function.
- What you can do after
- Apply it to defer a package submodule until a function is called.
Read how Secrets of the JavaScript Ninja, Third Edition explains dynamic import →
Acing the Frontend Interview
A dynamic import is a runtime JavaScript import expression that asynchronously loads a module on demand.
- How it is used
- Optimizes scalable applications by loading modules asynchronously on demand.
- How deep it goes
- Defines import() and its performance role but stops short of implementation details or a worked code example.
- Examples
- Uses import(), module scripts, and package.json type module as concrete module-system artifacts.
- What you can do after
- Apply import() to implement code splitting and lazy loading in modular JavaScript applications.
Read how Acing the Frontend Interview explains dynamic import →
Also covered in
- Modern Angular
- Fast by DefaultIn early access (MEAP)
- Vanilla WebIn early access (MEAP)
What to know first
- code splittingCode splitting divides application code into separately loadable bundles or chunks, allowing portions to be delivered independently.
- CommonJSCommonJS is a JavaScript module-system specification that defines how modules export and load values, traditionally using synchronous require calls and module.exports assignments.
- import statementAn import statement is a source-code declaration that makes definitions from another module, package, or namespace available in the current program context.
- promiseA JavaScript Promise is an object representing the eventual completion or failure of an asynchronous operation and its resulting value or reason.
Related concepts
- promiseproduces · A JavaScript Promise is an object representing the eventual completion or failure of an asynchronous operation and its resulting value or reason.
- import statementcontrasts with · An import statement is a source-code declaration that makes definitions from another module, package, or namespace available in the current program context.
- code splittingproduces · Code splitting divides application code into separately loadable bundles or chunks, allowing portions to be delivered independently.
- lazyused by · React.lazy is a React API for defining a component whose code is loaded asynchronously when needed.
- module namespace objectproduces · A module namespace object is an object that exposes a module’s exported bindings as properties.
- error handlinguses · Error handling is the practice of detecting, representing, propagating, and responding to failures that arise during software execution or operation.
Questions about dynamic import
What is dynamic import?
Dynamic import is a language feature that asynchronously loads a module at runtime and returns a promise for its module namespace.
Which Manning books explain dynamic import?
React Hooks in Action: With Suspense and Concurrent Mode, Secrets of the JavaScript Ninja, Third Edition and Acing the Frontend Interview.
What should I know before learning dynamic import?
Manning books that teach dynamic import usually introduce code splitting, CommonJS, import statement and promise first.
What is the difference between dynamic import and import statement?
Dynamic import is a language feature that asynchronously loads a module at runtime and returns a promise for its module namespace. An import statement is a source-code declaration that makes definitions from another module, package, or namespace available in the current program context.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


