Community JavaScript Snippet

Four Things I Forget About Create-React-App Every Year

Cheat sheet for the CRA quirks that keep coming back. Absolute imports via jsconfig, the HTTPS dev flag, the registerServiceWorker mystery, and the REACT_APP_ env var rules.

Four Things I Forget About Create-React-App Every Year

Cheat sheet for the CRA quirks that keep coming back. Absolute imports via jsconfig, the HTTPS dev flag, the registerServiceWorker mystery, and the REACT_APP_ env var rules.

JavaScript
Frontend
4 snippets
react
design-patterns
references
yunatorres

By @yunatorres

March 29, 2026

·

Updated July 4, 2026

308 views

6

4.3 (13)

Two minutes of config that ages well. The whole behaviour is one line: compilerOptions.baseUrl: 'src' in jsconfig.json (or tsconfig.json for TS projects), and CRA picks it up on the next dev-server start. Every import becomes rootable from src/, so a file three levels deep does not have to count ../../../. The two gotchas worth flagging are that the paths field for arbitrary aliases is not supported by CRA without ejecting or react-app-rewired, and that VS Code uses the same jsconfig.json for autoimport, so once you add it your tooling stops suggesting relative paths and quietly switches to the absolute ones. Modern bundlers (Vite, esbuild) handle this with resolve.alias; CRA's path is the JSON file.