5 ms·
This is thanks to many of the React dev team being strong proponents of outsourcing to micro deps for everything & remained strong supporters even after the lef
by mythz 6y ago
This is thanks to many of the React dev team being strong proponents of outsourcing to micro deps for everything & remained strong supporters even after the left-pad incident.
Imagine how much more enjoyable npm would've been if prominent JS devs took a sane approach to dependencies, like the TypeScript team who have no runtime deps.
The resulting npm deps of hell [1] means they need to rely on complex build solutions like Webpack to manage it all. My preference these days is to avoid npm/yarn all together and just use TypeScript watch (tsc -w) for incremental updates which lets you develop modern JS using modern fx's (e.g. Vue/React) without any of the npm/Webpack complexity & only requires a vastly simpler build solution to minify/bundle all UMD deps together.
[1] https://www.reddit.com/r/ProgrammerHumor/comments/6s0wov/heaviest_objects_in_the_universe/ https://www.reddit.com/r/ProgrammerHumor/comments/6s0wov/hea...
- dwaltrip 6y agoAccording to the link in the comment, apparently React has a total dependency tree with only 7 nodes, which is the opposite of what you are describing. I'm actually surprised, I thought React had many more dependencies. Edit: Removed comment related to typo, no longer relevant.
- mythz 6y agoWas a typo I meant `proponents`, fixed. The core library deps isn't relevant, it's how many deps the smallest starting Create React App has that matters [1]. As mentioned by OP react-native is far worse. [1] https://news.ycombinator.com/item?id=19195148 https://news.ycombinator.com/item?id=19195148
- realharo 6y agoWhy would create react app add more run-time dependencies? Isn't that just Babel and stuff used for building? Also, with TypeScript, Babel becomes completely unnecessary. I haven't used it in any of my React projects for years. Many templates still include it by default to match the JS version, but if you create the project from scratch without any scaffolding, there is no reason to do so.
- mythz 6y ago> Why would create react app add more run-time dependencies? Isn't that just Babel and stuff used for building? You can see all the dependencies it installs by running: $ npx create-react-app my-app > Also, with TypeScript, Babel becomes completely unnecessary. Right, as per my comment it's also my preferred approach: > My preference these days is to avoid npm/yarn all together and just use TypeScript watch In general I prefer Vue over React, but I prefer to use vanilla TypeScript & UMD deps to develop with either. > Many templates still include it by default to match the JS version It's what the React team is recommending to start with [1]: > Create React App is a comfortable environment for learning React, and is the best way to start building a new single-page application in React. [1] https://reactjs.org/docs/create-a-new-react-app.html#create-react-app https://reactjs.org/docs/create-a-new-react-app.html#create-...
- realharo 6y agoI just ran that. It took a long time, and the progress bar showed fetching 1381 packages. Definitely https://i.redd.it/i428f2ki0ho01.jpg https://i.redd.it/i428f2ki0ho01.jpg. However, the resulting `package.json` only shows 3 dependencies: react, react-dom and react-scripts. After `yarn build`, it added 3 more things from `@testing-library` (https://testing-library.com/ https://testing-library.com/), I assume those things won't make it into the production bundle. react and react-dom only depend on a tiny number of things, you can check that with any dependency visualizer. 6 or 7 in total for the whole tree, and most of those are tiny things that they just split off from react itself (e.g. prop-types). react-scripts is the huge beast that causes the dependency tree to explode. It is a `create-react-app`-specific package that contains all its build logic. So that seems to confirm the hypothesis that there actually aren't many runtime dependencies in the basic template, but who knows what it does behind the scenes. Also the LICENSE.txt file it generated for the biggest output .js file only includes entries for react, react-dom and object-assign. No idea about React Native.
- mythz 6y agoRight, each time a new project is created it contributes to global warming. The entire dependency matrix is what impacts normal development workflow, e.g. everytime I tried to update an old Webpack SPA project there would be always something that was broken that I'd have to hunt down & fix. > No idea about React Native. The OP suggests it's worse. But I no longer use React Native as I kept running into bugs & UI issues that were never fixed. I ended up reporting a few with complete repro's but didn't look like they were ever looked at, instead after a few months they decided to triage their 1000s of open issues, to get back to zero issue inbox. IMO React Native is architecturally flawed to run into so many issues when creating normal Apps after years of development, maybe if there were more developer resources on the team it would be more manageable. But I believe Flutter has a much better architecture [1] which feels much more integrated & polished that results in a more responsive app that works as advertised. [1] https://dart.dev/platforms https://dart.dev/platforms