# Behavior traces — react/create-react-app

> Canonical page: https://codevetter.com/unpack/create-react-app/behavior-traces

# Behavior traces — react/create-react-app

Scanned commit 6254386531d263688ccfa542d0e628fbc0de0b28 (2025-02-14). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

Three end-to-end traces matter: creating an app, starting the dev server, and producing a production build. A fourth shorter trace is the Jest test command and a fifth is eject. Each names the functions in call order as they appear in the source.
- Startup trace (npx create-react-app my-app --template typescript): index.js checks node version -> calls run() in createReactApp.js -> parses argv into program flags -> createApp(name, verbose, scriptsVersion, template, usePnp) -> validates app name with validate-npm-package-name -> makes the directory -> writes a temporary package.json -> installs react, react-dom, react-scripts, and the template package via spawn of npm/yarn -> executeNodeScript(react-scripts/scripts/init.js) with JSON argv. — [packages/create-react-app/index.js#L40-90](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/create-react-app/index.js#L40-L90) [packages/create-react-app/createReactApp.js#L160-450](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/create-react-app/createReactApp.js#L160-L450)
- init.js trace: verify node and react-scripts version compatibility -> copy template files from template/template into the app root -> merge template.json -> rename gitignore -> delete template package leftovers -> run git init, git add, git commit if git is available and the directory is not already a repo -> print Next steps (cd, npm start, npm test, npm run build, npm run eject). On failure it attempts to remove the created directory unless the user used . as the name. — [packages/react-scripts/scripts/init.js#L30-280](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/scripts/init.js#L30-L280) [packages/create-react-app/createReactApp.js#L450-650](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/create-react-app/createReactApp.js#L450-L650)
- Dev server trace (npm start -> react-scripts start): start.js sets BABEL_ENV=development and NODE_ENV=development -> require('../config/env') -> checkRequiredFiles([appHtml, appIndexJs]) exits 1 if missing -> checkBrowsers(appPath) reads browserslist -> choosePort(HOST, DEFAULT_PORT 3000) -> configFactory('development') -> createCompiler({config, appName, urls, useYarn, useTypeScript, webpack}) -> prepareProxy(package.json proxy, appPublic, HOST) -> createDevServerConfig -> new WebpackDevServer -> devServer.startCallback -> openBrowser(urls.localUrlForBrowser) -> listen for stdin end and signals to gracefully shutdown. — [packages/react-scripts/scripts/start.js#L30-200](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/scripts/start.js#L30-L200) [packages/react-dev-utils/WebpackDevServerUtils.js#L1-80](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-dev-utils/WebpackDevServerUtils.js#L1-L80) [packages/react-dev-utils/checkRequiredFiles.js#L1-30](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-dev-utils/checkRequiredFiles.js#L1-L30)
- Compiler hook trace inside createCompiler: compiler.hooks.invalid, beforeCompile, and done. On done, formatWebpackMessages splits errors and warnings; TSC errors are appended when useTypeScript; if errors exist, printBuildError-style instructions are shown and the dev server keeps running. Successful compiles clear the console (unless COMPILER_TERMINAL is set or CI) and print the local and network URLs. — [packages/react-dev-utils/WebpackDevServerUtils.js#L80-250](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-dev-utils/WebpackDevServerUtils.js#L80-L250) [packages/react-dev-utils/formatWebpackMessages.js#L1-80](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-dev-utils/formatWebpackMessages.js#L1-L80) [packages/react-dev-utils/printHostingInstructions.js#L1-40](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-dev-utils/printHostingInstructions.js#L1-L40)
- Production build trace: build.js sets NODE_ENV=production -> checkRequiredFiles -> checkBrowsers -> measure file sizes of existing build/ -> fs.emptyDirSync(paths.appBuild) -> copyPublicFolder() -> build(previousFileSizes) which returns a Promise around webpack(configFactory('production')).run -> formatWebpackMessages -> if errors, reject and print the first error only -> resolve with stats, warnings, previous sizes -> printFileSizesAfterBuild -> printHostingInstructions(appPackage, publicUrl, publicPath, buildFolder, useYarn). — [packages/react-scripts/scripts/build.js#L40-250](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/scripts/build.js#L40-L250)
- Test trace: test.js sets BABEL_ENV=test and NODE_ENV=test -> env.js loads .env.test and .env but not .env.local -> argv is rewritten so that --watch is added when stdin is a TTY and CI is unset, or --watchAll when --coverage is passed without an explicit watch flag -> require('jest').run(argv). createJestConfig resolves transformers relative to react-scripts so ejected apps can retarget them. — [packages/react-scripts/scripts/test.js#L20-140](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/scripts/test.js#L20-L140) [packages/react-scripts/scripts/utils/createJestConfig.js#L1-50](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/scripts/utils/createJestConfig.js#L1-L50)
- Eject trace: eject.js confirms prompt (unless CI) -> verifies git clean via git status --porcelain -> copies config/ and scripts/ from react-scripts into the app -> rewrites package.json dependencies by inlining react-scripts' own deps minus the blacklist -> replaces script entries -> removes react-scripts -> writes config files with a generated header comment. This is the documented escape hatch before 'alternatives to ejecting'. — [packages/react-scripts/scripts/eject.js#L40-200](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/scripts/eject.js#L40-L200) [docusaurus/docs/alternatives-to-ejecting.md#L1-30](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/docusaurus/docs/alternatives-to-ejecting.md#L1-L30)
- Template render trace for the default app: public/index.html is the HTML shell -> src/index.js imports React, ReactDOM, ./index.css, App, and reportWebVitals -> creates a root on document.getElementById('root') and renders <App /> -> App.js returns the header/logo/link tree -> App.test.js uses React Testing Library render and screen.getByText(/learn react/i). — [packages/cra-template/template/src/index.js#L1-30](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/cra-template/template/src/index.js#L1-L30) [packages/cra-template/template/src/App.js#L1-30](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/cra-template/template/src/App.js#L1-L30) [packages/cra-template/template/src/App.test.js#L1-20](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/cra-template/template/src/App.test.js#L1-L20)
- Browserslist gate: before start or build, checkBrowsers prompts (or fails in CI) when the browserslist config in package.json targets browsers that would pull in extra polyfills or when the default CRA browserslist is missing. Default template browserslist is production >0.2%, not dead, not op_mini all and development last 1 chrome/firefox/safari version. — [packages/react-dev-utils/browsersHelper.js#L1-80](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-dev-utils/browsersHelper.js#L1-L80) [packages/cra-template/template.json#L20-50](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/cra-template/template.json#L20-L50)
- Fast Refresh path: when FAST_REFRESH is not false, webpack entry includes the React Refresh client and babel-preset-react-app enables react-refresh/babel in development. webpackHotDevClient.js is still the CRA client that reports compile status; React Refresh handles component state-preserving updates separately from full reloads. — [packages/react-scripts/config/webpack.config.js#L100-200](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/webpack.config.js#L100-L200) [packages/babel-preset-react-app/create.js#L80-160](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/babel-preset-react-app/create.js#L80-L160) [packages/react-dev-utils/webpackHotDevClient.js#L1-40](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-dev-utils/webpackHotDevClient.js#L1-L40)
- --scripts-version path: if the user passes a version, tarball URL, or file: path, createReactApp installs that instead of the bundled react-scripts dependency. A custom fork must still expose scripts/init.js because executeNodeScript hard-codes that relative path inside the installed package. — [packages/create-react-app/createReactApp.js#L300-500](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/create-react-app/createReactApp.js#L300-L500) [packages/create-react-app/index.js#L50-80](https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/create-react-app/index.js#L50-L80)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
