CodeZettaInterview Hub

Node.js · Modules · Senior · Best Practice

When do you use dynamic `import()`?

Short Interview Answer

Code-splitting, optional/heavy deps, and conditional loading after feature flags.

Detailed Explanation

Returns a promise. Works in CJS and ESM. Useful for reducing startup cost of CLIs and servers.

Did you know this answer?