Skip to content

Commit

Permalink
Fix react-is import statement
Browse files Browse the repository at this point in the history
Fixes #6445
Fixes #6446
  • Loading branch information
mjackson committed Oct 31, 2018
1 parent 477b13b commit 90ecb35
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion packages/react-router-config/jest.config.js
Expand Up @@ -7,7 +7,7 @@ switch (process.env.TEST_ENV) {
mappedModule = "<rootDir>/umd/react-router-config.js";
break;
default:
mappedModule = "<rootDir>/modules/index";
mappedModule = "<rootDir>/modules/index.js";
}

module.exports = {
Expand Down
10 changes: 5 additions & 5 deletions packages/react-router-dom/.size-snapshot.json
Expand Up @@ -14,13 +14,13 @@
}
},
"umd/react-router-dom.js": {
"bundled": 159681,
"bundled": 159709,
"minified": 57597,
"gzipped": 16538
"gzipped": 16540
},
"umd/react-router-dom.min.js": {
"bundled": 97431,
"minified": 34632,
"gzipped": 10211
"bundled": 97476,
"minified": 34651,
"gzipped": 10216
}
}
2 changes: 1 addition & 1 deletion packages/react-router-dom/jest.config.js
Expand Up @@ -7,7 +7,7 @@ switch (process.env.TEST_ENV) {
mappedModule = "<rootDir>/umd/react-router-dom.js";
break;
default:
mappedModule = "<rootDir>/modules/index";
mappedModule = "<rootDir>/modules/index.js";
}

module.exports = {
Expand Down
5 changes: 4 additions & 1 deletion packages/react-router-dom/rollup.config.js
Expand Up @@ -21,7 +21,10 @@ const babelOptionsESM = {
plugins: [["@babel/transform-runtime", { useESModules: true }]]
};
const commonjsOptions = {
include: /node_modules/
include: /node_modules/,
namedExports: {
"../react-router/node_modules/react-is/index.js": ["isValidElementType"]
}
};

const external = id => !id.startsWith(".") && !id.startsWith("/");
Expand Down
14 changes: 7 additions & 7 deletions packages/react-router/.size-snapshot.json
@@ -1,8 +1,8 @@
{
"esm/react-router.js": {
"bundled": 24714,
"minified": 14466,
"gzipped": 3780,
"bundled": 24721,
"minified": 14469,
"gzipped": 3778,
"treeshaked": {
"rollup": {
"code": 4464,
Expand All @@ -14,13 +14,13 @@
}
},
"umd/react-router.js": {
"bundled": 99917,
"bundled": 99946,
"minified": 35992,
"gzipped": 11338
},
"umd/react-router.min.js": {
"bundled": 63384,
"minified": 22374,
"gzipped": 7857
"bundled": 63430,
"minified": 22393,
"gzipped": 7861
}
}
2 changes: 1 addition & 1 deletion packages/react-router/jest.config.js
Expand Up @@ -7,7 +7,7 @@ switch (process.env.TEST_ENV) {
mappedModule = "<rootDir>/umd/react-router.js";
break;
default:
mappedModule = "<rootDir>/modules/index";
mappedModule = "<rootDir>/modules/index.js";
}

module.exports = {
Expand Down
6 changes: 3 additions & 3 deletions packages/react-router/modules/Route.js
@@ -1,5 +1,5 @@
import React from "react";
import ReactIs from "react-is";
import { isValidElementType } from "react-is";
import PropTypes from "prop-types";
import invariant from "tiny-invariant";
import warning from "tiny-warning";
Expand Down Expand Up @@ -128,8 +128,8 @@ if (!React.createContext) {
if (__DEV__) {
Route.propTypes = {
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
component: function(props, propName) {
if (props[propName] && !ReactIs.isValidElementType(props[propName])) {
component: (props, propName) => {
if (props[propName] && !isValidElementType(props[propName])) {
return new Error(
`Invalid prop 'component' supplied to 'Route': the prop is not a valid React component`
);
Expand Down
5 changes: 4 additions & 1 deletion packages/react-router/rollup.config.js
Expand Up @@ -21,7 +21,10 @@ const babelOptionsESM = {
plugins: [["@babel/transform-runtime", { useESModules: true }]]
};
const commonjsOptions = {
include: /node_modules/
include: /node_modules/,
namedExports: {
"node_modules/react-is/index.js": ["isValidElementType"]
}
};

const external = id => !id.startsWith(".") && !id.startsWith("/");
Expand Down

0 comments on commit 90ecb35

Please sign in to comment.