Loading topic
tsc, and read a basic tsconfig.json. It covers the settings that matter when the compiler output is a package other people install, rather than an application you run yourself.6 min readtsc with a tsconfig.json, and know what a package.json is. It covers what declaration files are, which compiler options produce them, what goes wrong, and how to check the output. Later chapters cover how package.json points consumers at thes6 min readimport and export, and that you have run tsc with a tsconfig.json. It also assumes you know what a package.json is. You don't need to know how Node decides whether a file is ESM or CommonJS. That is the subject here.6 min readtsconfig.json, know what package.json is, and have used import and export in TypeScript. You do not need to know the exports field yet. The next chapters cover it.6 min readpackage.json, run tsc with a tsconfig.json, and tell ESM import syntax from CommonJS require. You have already seen the library layout and the declaration files that tsc emits into dist. Here you will see how three older package.json fields tell to6 min readtsc, and read a package.json. It also assumes you know the difference between ESM (import) and CommonJS (require) syntax. You will learn how the exports field tells Node.js, bundlers and TypeScript which files a consumer may load, and how 5 min readexports map with a types condition and that you know how a package is laid out after tsc has built it. Here you add more entry points, and you make sure consumers cannot reach files you did not intend to publish as API.5 min readpackage.json exports map with a types condition, you know what "type": "module" does, and you have a working tsc build for a library. It covers the case where one package must serve both import and require() consumers, and what has to match for Type5 min read.d.ts file and know what npm install puts in node_modules. You should also know the earlier chapters' setup: tsc emits declaration files into dist, and exports points consumers at them. Here the question is which packages your consumers must have insta5 min readtsc, you know what the exports field does, and you have run npm publish at least once. Here you decide which files end up in the tarball (the compressed archive that npm uploads) and check that decision before release.6 min read@acme/slugify package from the earlier chapters. That means a tsconfig.json that emits dist/, a package.json with an exports map, and a files list. You should also be comfortable running npm and npx commands.6 min readtsc, a working exports map, and a clean result from npm pack --dry-run, publint and Are the Types Wrong. You should also6 min readtsc to emit JavaScript and .d.ts files, you know how the exports field maps conditions to files, and you understand why a dual ESM and CommonJS package needs separate declaration files (.d.ts and .d.cts). The qu7 min read