Code Monkey home page Code Monkey logo

Comments (16)

caridy avatar caridy commented on May 4, 2024

@zemirco NPM can take care of de-duping the duplicated entries if the dependencies are correct. Make sure you are using a dependency at the app level that matches what we use in react-intl: "react": ">=0.11.2 <0.13.0"

from formatjs.

zemirco avatar zemirco commented on May 4, 2024

I'm using "react": "^0.12.2". Before that I used the new 0.13 beta and switched back. Maybe that caused the error.

from formatjs.

caridy avatar caridy commented on May 4, 2024

@zemirco cool, we will revisit the decision on the peerDepedencies vs dependecies, thanks for raising this issue.

from formatjs.

redonkulus avatar redonkulus commented on May 4, 2024

@caridy fyi that we did something similar with flux-router-component.

from formatjs.

ericf avatar ericf commented on May 4, 2024

How would moving it to peerDependencies solve the problem? People would still be stuck if this package had a per-dep of ^0.12.0 when the developer wanted to use React ^0.13.0-beta1 in their app.

from formatjs.

caridy avatar caridy commented on May 4, 2024

@ericf it will at least throw the error, saying that npm cannot install a conflicting version. Right now, you just get into the instanceOf issues when having multiple versions of react in your app.

from formatjs.

ericf avatar ericf commented on May 4, 2024

Okay, so it sounds like we'll want:

"peerDependencies": {
  "react": ">=0.11.2 <0.14.0"
}

This will include React 0.13 support — which we should make sure to test — and should be a minor release of this package; i.e., v1.x.

from formatjs.

caridy avatar caridy commented on May 4, 2024

plus the devDep for our tests to function, and for our development workflow

from formatjs.

athibaud avatar athibaud commented on May 4, 2024

just to chime in here. this is a common problem with any module which uses react.

if a dep is required then it must be a dependency. peerDependencies are only for modules which need the dep ~implicitly like express middleware (which never require express, but need to expose functions with (req, res, next) signature)

react-intl explicitly requires react and uses reacts' methods, therefore it is a dependency.

to have it as a peerDependency is incorrect. its the developers' responsibility to ensure you use the same versions of react and use npm dedupe to make sure you only have one version of react in your dependecy tree.

staying away from peerDependencies is a good idea. as we've experienced it causes trouble with deeply npm linked modules and it will probably be renamed or deprecated..

from formatjs.

caridy avatar caridy commented on May 4, 2024

@athibaud we have had this discussion internally and externally in multiple occasions and with different folks. I disagree, I don't think putting the burden on devs is a good idea, it never is. npm dedupe can do nothing if the dependencies are explicit, and that's the primary feature of NPM. Also, I don't think peerDependency will be deprecated, time will tell if I'm wrong or not.

from formatjs.

hershmire avatar hershmire commented on May 4, 2024

Is there a solution for handling this when using the latest React 0.13-alpha codebase?

from formatjs.

ericf avatar ericf commented on May 4, 2024

I'm changing my position on this. I want to keep it a [hard] dependency and avoid peerDependencies.

from formatjs.

ericf avatar ericf commented on May 4, 2024

This is only an issue right now because React's major version is < 1; once React hits 1.0, this goes away. Given that, and React's back-compat track record so far, I'm willing to open up the range to any React version <1.0.0. Once [email protected] is released, we'll move the range up to include ^1.0.0.

from formatjs.

pedroteixeira avatar pedroteixeira commented on May 4, 2024

Can this change be released to npm?

I'm having some trouble with npm shrinkwrap with react 0.13, and I think it's caused by react-intl:

npm WARN unmet dependency 
/node_modules/react-intl requires react@'>=0.11.2 <0.13.0' but will load
npm WARN unmet dependency /node_modules/react,
npm WARN unmet dependency which is version 0.13.0
npm ERR! Linux 3.13.0-45-generic
npm ERR! argv "node" "/usr/local/bin/npm" "shrinkwrap" "--dev"
npm ERR! node v0.10.32
npm ERR! npm  v2.5.1

npm ERR! Problems were encountered
npm ERR! Please correct and try again.
npm ERR! invalid: [email protected] 
/node_modules/react

from formatjs.

pedroteixeira avatar pedroteixeira commented on May 4, 2024

nevermind.. with npm 2.7.1 it worked (2.5.1 gives the error)

from formatjs.

ericf avatar ericf commented on May 4, 2024

React Intl v1.2.0 supports React v0.13+.

from formatjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.