Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

having 'BaseContext' is not exported from '@gatsbyjs/reach-router' in gatsby with typescript #509

Open
bambeusz opened this issue Jun 21, 2022 · 0 comments

Comments

@bambeusz
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @gatsbyjs/reach-router@1.3.7 for the project I'm working on.

I had a problem with starting my gatsby page saying:

warn ./.cache/root.js
Attempted import error: 'BaseContext' is not exported from '@gatsbyjs/reach-router' (imported as 'BaseContext').

and the website would load with the following error:
screenshot

I tried multiple plugin/loader related suggestions, but none of them worked as expected, so I created a patch for my project.

Here is the diff that solved my problem:

diff --git a/node_modules/@gatsbyjs/reach-router/es/index.js b/node_modules/@gatsbyjs/reach-router/es/index.js
index 335b455..4fbe187 100644
--- a/node_modules/@gatsbyjs/reach-router/es/index.js
+++ b/node_modules/@gatsbyjs/reach-router/es/index.js
@@ -722,4 +722,4 @@ var shouldNavigate = function shouldNavigate(event) {
 };
 
 ////////////////////////////////////////////////////////////////////////
-export { Link, Location, LocationProvider, Match, Redirect, Router, ServerLocation, createHistory, createMemorySource, isRedirect, navigate, redirectTo, globalHistory, match as matchPath, useLocation, useNavigate, useParams, useMatch };
\ No newline at end of file
+export { Link, Location, LocationProvider, Match, Redirect, Router, ServerLocation, createHistory, createMemorySource, isRedirect, navigate, redirectTo, globalHistory, match as matchPath, useLocation, useNavigate, useParams, useMatch, BaseContext };
diff --git a/node_modules/@gatsbyjs/reach-router/index.js b/node_modules/@gatsbyjs/reach-router/index.js
index 0b1dcb9..066f7f0 100644
--- a/node_modules/@gatsbyjs/reach-router/index.js
+++ b/node_modules/@gatsbyjs/reach-router/index.js
@@ -758,3 +758,4 @@ exports.useLocation = useLocation;
 exports.useNavigate = useNavigate;
 exports.useParams = useParams;
 exports.useMatch = useMatch;
+exports.BaseContext = BaseContext;
\ No newline at end of file

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant