Router: fix history import warnings
Created by: oleggromov
Issue
Because we're now in a transition state from router v5 to v6, which changes the way history
is imported and used internally (primarily because of the react-router-dom-v5-compat
package), we've got warnings like this at the build time:
WARNING in ../../node_modules/react-router-dom-v5-compat/index.js 431:15-25
export 'Action' (imported as 'Action') was not found in 'history' (possible exports: __esModule, createBrowserHistory, createHashHistory, createLocation, createMemoryHistory, createPath, locationsAreEqual, parsePath)
WARNING in ../../node_modules/react-router-dom-v5-compat/node_modules/react-router/index.js 12:0-74
export 'Action' (reexported as 'NavigationType') was not found in 'history' (possible exports: __esModule, createBrowserHistory, createHashHistory, createLocation, createMemoryHistory, createPath, locationsAreEqual, parsePath)
WARNING in ../../node_modules/react-router-dom-v5-compat/node_modules/react-router/index.js 849:21-31
export 'Action' (imported as 'Action') was not found in 'history' (possible exports: __esModule, createBrowserHistory, createHashHistory, createLocation, createMemoryHistory, createPath, locationsAreEqual, parsePath)
This can be reproduced by running yarn build-web
on the current main
.
Fix
In order to fix it, we remove the resolution of history to a particular version (why did we even need it?) and install @types/history
. The latter won't be needed once we complete the migration, but since it's just a devDependency
used at the build time only, there's no downside.
Test plan
- Run
yarn build-web
on main and see the errors - Check out this branch, run
yarn
and thenyarn build-web
again - Make sure there're no warning anymore
App preview:
Check out the client app preview documentation to learn more.