phosphor-icons / react

A flexible icon family for React
https://phosphoricons.com
MIT License
1.1k stars 57 forks source link

./node_modules/@phosphor-icons/react/dist/lib/context.mjs Can't import the named export 'createContext' from non EcmaScript module (only default export is available) #89

Open shreyas-aw opened 6 months ago

shreyas-aw commented 6 months ago

Describe the bug

Unable to build the project after doing npm install with latest build v2.1.4

Steps to Reproduce

Install v2.1.4 and try to run react project you will find the issue in console

./node_modules/@phosphor-icons/react/dist/lib/context.mjs Can't import the named export 'createContext' from non EcmaScript module (only default export is available)

Expected behavior

No error should be reported in console or in browser. It should work as normal.

Screenshots

image image

Context (please complete the following information):

shreyas-aw commented 6 months ago

Failed at Vercel as well

image
shreyas-aw commented 5 months ago

@rektdeckard Sorry to bother, but do you have any update on this bug ?

anu2308 commented 4 months ago

Any update on this bug? Any solution? facing the same problem with exact same error message and configuration.

rektdeckard commented 4 months ago

@shreyas-aw I assume this is a Nextjs app, because Vercel and thats the only kind of bug reports we get here anymore. Can you share your Next version and example of usage? Are you using the ssr version of the icons, and how are you importing them? If not, are the csr icons being used in client components?

rektdeckard commented 4 months ago

A minimal reproduction would be appreciated.

anu2308 commented 4 months ago

@rektdeckard Am using "@phosphor-icons/react": "^2.0.5" csr and using react for frontend...

anu2308 commented 4 months ago

@rektdeckard Am using "@phosphor-icons/react": "^2.0.5" csr and using react for frontend...

I solved the issue, the problem was with my package.json using react script version 3.4+, I updated it to version 5.+ and it worked

shreyas-aw commented 4 months ago

@anu2308, I am already pointing to "react-scripts": "^5.0.1" but still received error, if possible can you please paste your package.json file here.

shreyas-aw commented 4 months ago

@shreyas-aw I assume this is a Nextjs app, because Vercel and thats the only kind of bug reports we get here anymore. Can you share your Next version and example of usage? Are you using the ssr version of the icons, and how are you importing them? If not, are the csr icons being used in client components?

Sorry @rektdeckard, it is a react app.

danihml-triibo commented 3 months ago

anyone has solved this problem? I'm facing the same issue here.

React App v17, Node v16. Only the legacy version (phosphor-react import) is working.