diff --git a/.npmignore b/.npmignore index 89017a6..db73954 100644 --- a/.npmignore +++ b/.npmignore @@ -1,9 +1,9 @@ docs node_modules -src +# src .babelrc .gitignore .npmignore .prettierrc rollup.config.js -yarn.lock \ No newline at end of file +yarn.lock diff --git a/index.js b/index.js index 8b4c81d..97e7567 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ 'use strict'; -if (process.env.NODE_ENV === 'production') { - module.exports = require('./lib/index.min.js'); -} else { - module.exports = require('./lib/index.js'); -} \ No newline at end of file +// if (process.env.NODE_ENV === 'production') { +// module.exports = require('./lib/index.min.js'); +// } else { +// module.exports = require('./lib/index.js'); +// } +module.exports = require('./src/index.js'); diff --git a/package.json b/package.json index d7465cc..a07573d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "react-router-cache-route", "version": "1.13.0", "description": "cache-route for react-router base on react v15+ and router v4+", - "main": "index.js", + "main": "src/index.js", "scripts": { "build": "rollup --config" }, diff --git a/src/components/CacheSwitch.js b/src/components/CacheSwitch.js index 58bd605..7c70fec 100644 --- a/src/components/CacheSwitch.js +++ b/src/components/CacheSwitch.js @@ -33,7 +33,11 @@ class CacheSwitch extends Switch { } render() { - const { children, which, autoFreeze } = this.props + const { + children, + which = element => get(element, 'type.__name') === 'CacheRoute', + autoFreeze + } = this.props const { location, match: contextMatch } = this.getContext() let __matchedAlready = false @@ -131,8 +135,4 @@ if (isUsingNewContext) { } } -CacheSwitch.defaultProps = { - which: element => get(element, 'type.__name') === 'CacheRoute' -} - export default CacheSwitch