Skip to content

Context is not defined inside context provider #3749

Discussion options

You must be logged in to vote

So I found the culprit. It looks like you're developing on a mac and on macOS the file system is case insensitive by default. Meaning foo.ts is treated the same as Foo.ts. But vite is able to detect that and treats both files as a separate module. The thing is that in the repo provided there is no duplicate file, but rather a casing issue in imports.

In ./src/appWrapper.jsx, pay close attention to the casing:

  import { ExampleRoute } from "./routes/ExampleRoute";
  import MainContainer from "./components/MainContainer";
- import { Router, RouteComponent } from "./context/router";
+ import { Router, RouteComponent } from "./context/Router";

  import "./assets/globals.scss";

So what ends …

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@marvinhagemeister
Comment options

@JuanICasareski
Comment options

@marvinhagemeister
Comment options

Comment options

You must be logged in to vote
1 reply
@JuanICasareski
Comment options

Answer selected by marvinhagemeister
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants