Loading topic
import in your code names a module with a string. The compiler needs to turn that string into a file so it can read the types. That step is module resolution. This chapter builds the working model you need for the rest of the tutorial and shows the errors you will see when the model breaks.5 min readimport and export, run tsc with a tsconfig.json, and read a package.json. It also assumes you know that Node.js runs two module systems. Here you will learn the rules that decide which system each file belongs to, because nodenext resolu5 min readimport and export, run tsc with a tsconfig.json, and know that Node.js runs both CommonJS and ES modules. It covers the two compiler options that control how imports are handled, and how they interact.5 min readtsconfig.json, and run tsc. It also assumes you know that Node.js runs both CommonJS (CJS) and ES modules (ESM), and that you have seen main and dependencies in package.json. Earlier chapters covered the module and `5 min readtsconfig.json, know that module and moduleResolution are separate options, and know that a package's "type" field decides whether .js files are ESM or CommonJS. The previous chapter covered how nodenext resolves imports in general. This chapter covers 5 min readnodenext and bundler differ at a high level. It also assumes you can read a package.json with main, type, and exports fields. It covers the second half of every resolution: after TypeScript finds a file for an import, wher6 min readtsconfig.json and tsc do, and you know that Node.js runs both CommonJS and ES modules. You should also know the main and dependencies fields of package.json. It covers the exports field and how TypeScript us6 min readnodenext resolves imports and how package.json exports maps work. You should know the difference between a module's output format and the way the compiler finds a file, and you should be comfortable reading a tsconfig.json.5 min read.mts, .cts, .mjs and .cjs extensions, or from the nearest package.json "type" field. It also assumes you have read the earlier chapters on nodenext resolution and extension 5 min readtsconfig.json, know how nodenext and bundler resolution differ, and have seen a relative import fail. Earlier chapters covered both modes and the extension rules. Here the question is narrower: what the paths option does, and what it leaves undone.6 min readtsconfig.json and run tsc from a terminal. It also assumes you know the module and moduleResolution options and how package.json exports works, which earlier chapters covered. It turns those ideas into a debugging routine. When an import fails, you can6 min readnodenext or bundler for a project. It assumes you can read a tsconfig.json, you know that Node.js runs both CommonJS and ES modules, and you have seen the module and moduleResolution options. The earlier chapters explained how each mode resolves imports. Here th6 min readnodenext and bundler resolve imports, how package.json exports conditions work, and how a file's format (ESM or CommonJS) is decided. Here you apply that knowledge to one task: shipping a package that type-checks and loads correctly for every kind of consume6 min read