question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rethink decision to make react-scripts a dependency instead of a devDependency

See original GitHub issue

Is your proposal related to a problem?

The decision to make react-scripts a dependency causes a lot of issues regarding perceived security vulnerabilities. Even though the issues themselves are technically harmless, these issues often break CI/CD flows and/or end up being reported here as actual issues.

Describe the solution you’d like

The decision to make react-scripts a dependency was in my opinion ill-conceived. There are issues with having react-scrips a devDependency as stated in the original pull request:

  • The distinction does not make sense. Nonetheless, tools like npm audit are dependent on this distinction.
  • Apparently some people build on the production server? They shouldn’t.
  • An actual run-time dependency in the form of a polyfill is included. This could be a separate (and optional?) dependency.
  • Eject crashes in some situations (issue #2655)
  • Possibly other issues…

In my opinion, a shortcut was taken to work around some problems that should have been fixed separately.

Describe alternatives you’ve considered

It’s possible to move react-scripts to devDependencies by hand, or to eject your React application. Both solve the problem (afaict) but a lot of people are not willing to do this or are unaware of the possibility.

Another possibility would be for the developers to update dependencies whenever a vulnerability pops up as fast as possible, and/or to help developers of dependent package to fix their dependencies. Maybe get Facebook to throw some money behind a React Vulnerability Strike Team ™ or something.

Additional context

One way or another a solution is needed. Every time some vulnerability pops up I see a lot of frustration in the comments. Even though someone always politely explains the actual security implications, there are always a few people saying (and probably more people thinking) that you don’t actually care that much about security. Rationally I know this not to be true, but I get frustrated as well sometimes (I’m only human after all).

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:39
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

How to do a react build, when react-scripts is marked as dev ...
If I mark react-scripts as dev-dependency, since i don't need it for production, and install all the packages using 'npm install --production', ...
Read more >
10 Fun Facts About Create React App | by Jennifer Fu
According to NPM dependencies definition, the build dependency, react-scripts , should be a devDependency . However, it is in the dependencies section along ......
Read more >
STOP Using Create React App - YouTube
Create React App is a plague and we're here to cure it. Please use Vite, NextJS, or Remix instead. Seriously, anything is better...
Read more >
4 Reasons Why You Should Prefer Vite Over Create-React ...
Unlike CRA, Vite does not build your entire application before serving, instead, it builds the application on demand.
Read more >
Should you Pin your JavaScript Dependencies?
Once you start using a tool/service like Renovate, probably the biggest decision you need to make is whether to "pin" your dependencies instead...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found