diff --git a/CHANGELOG.md b/CHANGELOG.md index a86b38d96..0f05e3da3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # HEAD +- Fixed: ``Uncaught TypeError: (0 , _reactRouterScroll2.default) is not a function`` + We now + [only import ``useScroll``](https://github.com/taion/react-router-scroll#minimizing-bundle-size) + from react-router-scroll (as we only use this). + ``react-router-scroll@0.3.1`` was exporting a default value, ``0.3.2`` is not. + ([#627](https://github.com/MoOx/phenomic/issues/652) - @MoOx) - Added: better webpack build notifications. We replaced [`webpack-error-notifications`](https://github.com/vsolovyov/webpack-error-notification) diff --git a/flow/interfaces/node-modules/react-router-scroll.js b/flow/interfaces/node-modules/react-router-scroll.js index 86823738d..df040a4ef 100644 --- a/flow/interfaces/node-modules/react-router-scroll.js +++ b/flow/interfaces/node-modules/react-router-scroll.js @@ -1,4 +1,10 @@ +type useScroll = + (shouldUpdateScroll?: () => boolean | Array) => Function + declare module "react-router-scroll" { - declare var exports: - (shouldUpdateScroll?: () => boolean | Array) => Function; + declare var exports: useScroll; +} + +declare module "react-router-scroll/lib/useScroll" { + declare var exports: useScroll } diff --git a/package.json b/package.json index 596d58d6b..1e7b532f9 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "opn": "^4.0.2", "pify": "^2.3.0", "portfinder": "^1.0.2", - "react-router-scroll": "^0.3.1", + "react-router-scroll": "^0.3.2", "redbox-react": "^1.2.2", "remark": "^5.0.0", "remark-autolink-headings": "^4.0.0", diff --git a/src/client/index.js b/src/client/index.js index 14fc70d63..53448d70a 100644 --- a/src/client/index.js +++ b/src/client/index.js @@ -4,7 +4,7 @@ import React from "react" import ReactDOM from "react-dom" import { Router, useRouterHistory, applyRouterMiddleware } from "react-router" import createBrowserHistory from "history/lib/createBrowserHistory" -import useScroll from "react-router-scroll" +import useScroll from "react-router-scroll/lib/useScroll" import { Provider as ReduxContextProvider } from "react-redux" import PhenomicContextProvider from "../ContextProvider"