Comments (16)
@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.
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.
@zemirco cool, we will revisit the decision on the peerDepedencies
vs dependecies
, thanks for raising this issue.
from formatjs.
@caridy fyi that we did something similar with flux-router-component.
from formatjs.
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.
@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.
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.
plus the devDep for our tests to function, and for our development workflow
from formatjs.
just to chime in here. this is a common problem with any module which uses react.
if a dep is require
d 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 require
s 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 link
ed modules and it will probably be renamed or deprecated..
from formatjs.
@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.
Is there a solution for handling this when using the latest React 0.13-alpha codebase?
from formatjs.
I'm changing my position on this. I want to keep it a [hard] dependency and avoid peerDependencies
.
from formatjs.
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.
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.
nevermind.. with npm 2.7.1 it worked (2.5.1 gives the error)
from formatjs.
React Intl v1.2.0 supports React v0.13+.
from formatjs.
Related Issues (20)
- Update translation of 'last year' for Swedish locale HOT 1
- @formatjs/cli-lib is not an ESM module HOT 1
- formatMessage with ICU behave different then formatNumber HOT 2
- [@formatjs/intl Error MISSING_DATA] should be a warning not an error HOT 3
- [@formatjs/intl-durationformat] package.json deprecation warning HOT 2
- @formatjs/intl-messageformat, 10.5.0: Plural rules aren't applied correctly HOT 2
- @formatjs/intl-numberformat/polyfill: roundingIncrement seems to be a no-op HOT 3
- [docs] Rich Text Formatting example doesn't work HOT 2
- Polyfill.io has been sold to a weird Chinese company and should no longer be recommended HOT 1
- chore: update tzdata to 2024a
- INVALID_TAG when parsing regular HTML tag with attribute HOT 1
- Can't catch error HOT 1
- Feature request: allow units greater than `day` in `FormattedRelativeTime` with `updateIntervalInSeconds` to be picked HOT 2
- It's incredibly slow on lower end Android devices HOT 2
- Intl.Segmenter: isWordLike does not match Node.js and browsers HOT 2
- @formatjs/intl-locale/polyfill-force TypeError: Error uninitialized locale at Locale2.getWeekInfo HOT 3
- .formatMessage is not working when provided messages has object with `type: 1` HOT 8
- Extract does not work on vue template since vue 3.4.0 HOT 1
- eslint-plugin-formatjs doesn't check `this.intl.formatMessage(...)` usages HOT 1
- `LocaleMatcher` doesn't work on propietary tags
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formatjs.