TypeScript · Middle · Question 44 of 75

How does moduleResolution: 'bundler' differ from 'node16'/'nodenext'?

Explanation

In Node.js ESM you must write extensions in relative imports and account for exports/type. Bundlers (Vite, Next.js, esbuild) are forgiving about this, and bundler mode mirrors their behavior. For code run by Node.js without a build step, choose nodenext.

Further reading

Problem with a question

TypeScript · Middle · question 44

Test yourself

Take the TypeScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz