Search code examples
javascriptreactjscreate-react-app

How does create-react-app tool work without babel or any build tool?


I usually use webpack and babel to configure my react project. Recently trying to use create-react-app. The thing is when you create your app using create-react-app there is no babel or any build tools like gulp installed on the project as it seems in package.json file. So how does ES6 or other stuff work without these tools?


Solution

  • Stuff like babel and webpack are dependencies of the react-scripts package, so even though they're not directly listed in your package.json, they get downloaded by npm (or yarn) as part of installing the dependencies of the dependencies, and their dependencies.

    Here's the package.json file for react-scripts, and you can see all the dependencies there: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/package.json

    This effect is called a dependency tree, and you can end up with loads of libraries that you have no idea about.

    More here: https://en.wikipedia.org/wiki/Dependency_grammar