-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Cannot read properties of undefined (reading 'createContext') #63
Comments
The error indicates that the UMD bundle is being imported. I don't know exactly why this would cause issue, but it could be related. It may have something to do with the React peer dependency and your bundling process, because I read this error as saying "Webpack can't find the React import at runtime", and with UMD react libraries, Couple ideas: You might want to try upgrading from 2.0.6 to 2.0.10, which has Try changing from This isn't an error I have seen with Phosphor before, and it looks more like something with your bundling. |
Hey - Thanks for your suggestions @rektdeckard Unfortunately still not joy. I bumped to I have been poking around with our You suggestion to change the imports of react to
|
Ok, so I've got it working... I'm cautious about calling it a total victory but it has unblocked me for what has been 3 days of not much fun. I've added the minified React bundles to our
In your response when you said that the umd couldn't find |
Just another thought, I see |
And in fact, in every consumer too |
Hello we're seeing an issue when consuming our toolkit library in a new project.
I'll try to give a brief description of the project structure since it's quite big.
Our Component Toolkit Lib
This library contains lots of react components as well as Icons and is bundled and then consume via npm in the child application. The library is using
styled-components
and uses aThemeProvider
to wrap our application.Since we're using many different Icons from
phosphor
and want to "theme" them in a common way, we created a component calledIcon
which accepts a recognisedIconName
. We then use that name to map it to an Icon within@phosphor/react
Example of our
icon-map.ts
file:And then to consume these icons we look them up in the
Icon.tsx
file:The problem then occurs when we use our library in the consuming applications.
And then we see the problem. Any ideas?
These are the main versions we're using in our application:
The text was updated successfully, but these errors were encountered: