The Ecosystem
An ecosystem of tools helps you manage dependencies, bundle code for production, test your applications, and maintain code quality.
# A typical project setup
npm init -y
npm install vite --save-dev
npm install eslint prettier --save-dev
npm install vitest --save-dev
This chapter gives an overview of the tools you will run into in real projects. You do not need to learn all of them right away. Knowing what they do and when to use them is enough to start, and it will make your work easier.
Tool Categories
| Category | Purpose | Popular Tools |
|---|---|---|
| Package Management | Install and manage dependencies | npm, yarn, pnpm |
| Build Tools / Bundlers | Dev server + production optimization | Vite, Webpack, Rollup, esbuild |
| Testing | Verify code correctness | Jest, Vitest |
| Linting | Catch errors and enforce style | ESLint |
| Formatting | Consistent code formatting | Prettier |
Why We Need These Tools
Package management manages dependencies for you, so you do not download libraries and track versions by hand.
Bundlers let browsers load applications with hundreds of modules efficiently.
Testing catches bugs during development instead of in production.
Linting and formatting keep codebases consistent and easier to maintain.
Learning Outcomes
- Manage project dependencies with npm and alternative package managers, using semantic versioning and lock files to keep installs predictable
- Set up a bundler, such as Vite or Webpack, and apply build optimizations to ship efficient production code
- Write and organize unit and asynchronous tests, using mocks and best practices to build a reliable test suite
- Enforce code quality and consistency with linting, formatting, and automated Git hooks
Sections
- Package Management with
npm - Semantic Versioning and Dependencies
- Alternative Package Managers
- Bundlers and Vite
- Webpack and Other Bundlers
- Build Optimization
- Testing with Jest
- Mocking and Async Testing
- Testing Best Practices
- Linting with ESLint
- Formatting with Prettier
- Integrating Linters, Formatters, and Git Hooks
- Practice Questions