1

Question

Why calling npx create-react-app my-app added 1914 packages (40714 items with size 300 MB) from 784 contributors [https://github.com/facebook/create-react-app#creating-an-app][1]

Another way to say the question :

Q1- Consider this hello world is my production hello world application, so that need this much? (sure it may require several further learning to reduce its size or optimized etc, but why added so much complexity in the first place?)

Q2- What is another way to create a react app from scratch where we can have control like what to be included and if included then with reason? ( A helpful link or steps or links, usually experienced react professionally follows )

Details

#1.I can see similar quesions e.g.

Why does an npm module I wrote install so many packages after creating project with create-react-app?

create-react-app only creates node_modules, package and package-lock

But no one very clearly defines what going on? In most of my experience to run a hello world kind of stuff should be just simple e.g. a react library and react code?

#2. babel/core 7.12.10 takes only 172 KB of size. refer: https://www.npmjs.com/package/@babel/core

#3. Agreed it may have much stuff e.g. What Included in https://github.com/facebook/create-react-app#creating-an-app, But on that readme, It's not clearly defined further. Yes I checked articles everywhere it says to create react app npx create-react-app my-app, and the story started.

Sumit Arora
  • 5,051
  • 7
  • 37
  • 57

1 Answers1

0

First off, your production build will not include everything in your /node_modules-folder, only the stuff that is necessary. If you used create-react-app to setup your app you can run npm run build or yarn build, which will then pack everything you app needs into the /build-folder.

Like you state in your post, create-react-app is simply a shortcut to setup an environment for react development with common settings preconfigured. It is perfectly possible to setup everything you need yourself. This guide is an excellent and detailed guide to a barebones react installation.

Henrik Erstad
  • 681
  • 3
  • 11
  • 21
  • Thanks, @Henrik Erstad for the answer, Agreed with your answer. I did see many devs who are new (or beginner or even intermediate) to react /node js and start with create react app or similar, end up packaging a heavy docker image even for the smallest frontend-app. so thought to post a better-typed question, and your answer is helpful. – Sumit Arora Dec 15 '20 at 10:00