.gitignore for Node.js + React

Full .gitignore for React apps built with Create React App, Vite, or custom Webpack/Node setups.

Quick presets

Selected (2)
NodeReact
Your selections never leave your browser. Generation happens entirely client-side.
Raw

23 patterns · 489 B

# Generated by DevZone Tools — https://devzone.tools/tools/gitignore-generator
# Templates: Node, React
# 2026-04-20

# ---- Node ----
# Node
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
.pnpm-debug.log*
.npm
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
lerna-debug.log*
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
dist/
build/
.cache/
*.tsbuildinfo

# ---- React ----
# React
coverage/

Why use Node.js + React together?

React projects almost always run on a Node.js toolchain, making this one of the most common .gitignore combinations. The Node template handles node_modules and package manager logs while the React template adds build/ output and Create React App environment file patterns.

The most important overlap to know: both templates reference node_modules/ and .env files. When combined, duplicates are automatically removed and the first occurrence wins. The resulting file is clean and deduplicated.

Frequently asked questions

Do I need to commit .gitignore?
Yes — .gitignore should be committed to the repository so all collaborators benefit from the same ignore rules.
How do I add custom patterns?
Open your .gitignore file and add the pattern on a new line. Use # for comments, * for wildcards, / to match directories, and ! to un-ignore a previously ignored path.
How do I ignore a file that is already tracked?
Adding a file to .gitignore does not remove it from tracking if it was previously committed. Run: git rm --cached <file> to stop tracking it without deleting the file locally.
Why combine Node and React?
React projects almost always run on a Node.js toolchain, making this one of the most common .gitignore combinations. The Node template handles node_modules and package manager logs while the React template adds build/ output and Create React App environment file patterns.

Looking for something else? Browse all templates →