React-router: PropType warnings with React 15.5

Created on 26 May 2017  路  13Comments  路  Source: ReactTraining/react-router

4.1.1 Router component shows the following warnings with React 15.5.4:

Warning: Failed prop type: Calling PropTypes validators directly is not supported by the 'prop-types' package. Use PropTypes.checkPropTypes() to call them.

Warning: Failed context type: Calling PropTypes validators directly is not supported by the 'prop-types' package. Use PropTypes.checkPropTypes() to call them.

Most helpful comment

Finally found some time for this. Re-published react-router and react-router-dom as 4.1.2. No changes other than updated bundled deps.

All 13 comments

These warnings do not seem to occur when using react-router in a modern React app.
(Which uses npm/yarn for dependencies and Webpack 2 with Babel 6 for compiling/bundling everything).

The warnings only occur when using the pre-built umd build I got after npm installing react-router 4.1.1.
(Which I have to do in an older legacy project which uses a custom build system based on RequireJS, that requires me to manually copy dependencies over to a specific folder, instead of using npm.)

After manually cloning react-router and running the build script manually the errors seem to be resolved.

What I did exactly:
$ git clone [email protected]:ReactTraining/react-router.git
($ cd react-router)
($ npm i -g yarn)
($ cd packages/react-router-dom)
npm run build

For reference, I've included a zip file with the react-router-dom(.min).js files from the umd folder you get after npm installing react-router (4.1.1), and the files I built manually as described above.

After running a diff between the non-minified files in each folder the only things that seem to be changing is something internal for React. So I'm still not sure what actually causes this issue. But atleast it's not present in the newly built files included in the zip file.

The only thing I can imagine is that the version of React that was used to generate the umd files included in the npm install was somehow different than when I built it manually.
I'm currently using the latest version of React (15.5.4 at the time of posting this).

I need to rebuild the UMD release. The version of prop-types was broken for UMD builds when I pushed out 4.1.1. It's literally just a rebuild and push, no changes needed.

Whoops, want to leave this open as a reminder to myself :)

Yay, when this is rebuilt it will clear up the last React 15.5.4 migration warnings for us!

See also #5045

I followed @ThomasBrekelmans' instructions and published the results at PeteX/react-router-built. This means you can load the files as:

https://cdn.rawgit.com/PeteX/react-router-built/211d1a40/react-router-dom.js
https://cdn.rawgit.com/PeteX/react-router-built/211d1a40/react-router-dom.min.js

I'll probably delete the repository soon after the next release of react-router, but the files should stick around thanks to rawgit's caching.

My files are not quite the same as @ThomasBrekelmans' and that's probably because I specifically checked out 4.1.1 rather than just building the head.

I hope this helps someone!

@PeteX thanks, it helped me!

Since there doesn't seem to be a new release on the horizon, could you please publish a rebuilt version as 4.1.2?

I know, I know. I'll try to do it today at some point.

I seem to get a similar issue when using fusebox to build instead of webpack....

image

_EDIT: My problem seems to have been solved after installing prop-types and then removing the fusebox cache (.fusebox in root folder)_

Please @timdorr 馃檹

git checkout tags/v4.1.1
npm version 4.1.2
lerna run build
npm publish

Finally found some time for this. Re-published react-router and react-router-dom as 4.1.2. No changes other than updated bundled deps.

I've just tried the new release, and it works perfectly, thanks.

The build I uploaded to Github is no longer needed so I'll delete that. As I said, I expect the files to stick around thanks to RawGit's caching, but you should probably move your site to release 4.1.2 to be on the safe side.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexyaseen picture alexyaseen  路  3Comments

ArthurRougier picture ArthurRougier  路  3Comments

stnwk picture stnwk  路  3Comments

ackvf picture ackvf  路  3Comments

wzup picture wzup  路  3Comments