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.

Direct dependency to React?

See original GitHub issue

Hi, why did you added React and ReactDOM as a dependency to BackstopJS? Since that point I can’t use BackstopJS anymore because my project depends on React 16.1. and BackstopJS relies on React 15. When I run my tests with Jest they crash because of different versions of React. With BackstopJS 3.0.39 everything worked fine in the past.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
screendrivercommented, Mar 9, 2018

Hi @mantovanig,

ok, cool. But why do you have a dependency to React in general? If you made it as a peerDependency you are assuming / forcing the consuming project to use React. What if you want to use BackstopJS but don’t have nothing to do with React? For example if your project uses Angular or Vue. These projects are now forced to install React just for BackstopJS? 🤔

0reactions
visionmonstercommented, Jun 26, 2018

I think you would want all of the react / webpack code as a devDependencies sections. I think this would hold for any dependency that only applies to generating the compare/output code.

from the npm docs: https://docs.npmjs.com/files/package.json#devdependencies

If someone is planning on downloading and using your module in their program, then they probably don’t want or need to download and build the external test or documentation framework that you use In this case, it’s best to map these additional items in a devDependencies object.

It’s fine to have it as a dependency if it’s an application, but I think the trouble comes from using it as a Module especially with react.

fantastic library by the way.

I think this is the dependency structure you are looking for

https://github.com/garris/BackstopJS/pull/813

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency injection in React - LogRocket Blog
Dependency injection (DI) is a pattern where components necessary for your code to run are hot-swappable. This means that your dependencies ...
Read more >
Add a Dependency to React in package.json for a ... - Pluralsight
Developing apps in React involves external dependencies as reusable components published by other React developers that you can use in your ...
Read more >
create-react-app dependency version issues with React 18
Go back to your root folder and run npx create-react-app my-app (your app name) --template file:PATH_TO_YOUR_CUSTOM_TEMPLATE.
Read more >
Advanced Dependency Injection in React - Bits and Pieces
Dependency Injection with React · 1. Using props allows dependency injection. function welcome(props) { return <h1> Hello, {props.name}</h1>; } · 2.
Read more >
React Has Built-In Dependency Injection - Marmelab
Dependency Injection is a popular pattern that many frameworks implement - but React.js, apparently, doesn't. It turns out React has a ...
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