Loading topic
src/, write compiled output to dist/, and expose the supported API through one public entry point.2 min readimport and export work. It also assumes you have used tsc, the TypeScript compiler, with a tsconfig.json file.2 min readtsc, and basic import and export syntax. You will configure a library build so that JavaScript consumers receive runnable code and TypeScript consumers receive the library’s public type information.2 min readtsc. It also assumes you know that a package can contain both source files and compiled files. The key question here is how Node.js decides whether a JavaScript file uses ESM or CommonJS.2 min readnpm, and basic tsconfig.json settings. This chapter explains how the moduleResolution setting finds the JavaScript and declaration files in an installed package.2 min readpackage.json, and ES module import and export syntax. You should also understand that a published package has two consumers: a runtime that executes JavaScript and a type checker that reads TypeScript declarations.2 min readpackage.json, and basic ESM import and export syntax. You should also know how tsc emits files into a dist directory.2 min readtsconfig.json. This chapter focuses on how the exports field controls which package paths consumers may import.2 min readpackage.json, and basic import and export syntax. This chapter focuses on packages that support both modern ESM and older CommonJS consumers.2 min readtsconfig.json, and basic npm package management. This chapter focuses on one question: what must your published package declare when its exported types refer to other packages?2 min readpackage.json, and TypeScript builds. The goal is to publish the files consumers need while keeping source code, tests, and local configuration out of the package.2 min readpackage.json, and basic ESM import syntax. This chapter focuses on verification: checking what npm will publish, checking package metadata, checking type resolution, and testing the package from a separate consumer project.2 min readpackage.json, npm scripts, and the difference between ESM and CommonJS. This chapter focuses on releasing a package safely. It covers version numbers, pre-release checks, and the npm publish command.2 min readtsconfig.json, and basic ESM imports and exports. This chapter focuses on build choices for a library that already has a public entry point and needs both JavaScript output and usable declaration files.3 min read