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
Error caused by exports
field in package.json
#41
Comments
I'm not sure I understand. This is a valid |
If you want to link me the repo I could take a look. I could remove this field altogether, since the |
Ok, thank you. I will check again tomorrow to see if there's something I can change in the esbuild configuration and/or in my Turborepo setup and I'll let you know. I'll link you my repo when I commit the changes since right now I have them locally on my machine. |
Some digging shows that TS may need assistance with export maps in node versions |
Transferring issue to |
Ok, so... I've checked and I'm using the latest version of both Typescript ( Previously I said I was using esbuild but I meant tsup, I guess I got confused since tsup uses esbuild under the hood. I took me a while but I converted the package to type "module": "nodenext", in my Removing the As a last note, if you want you can see the repo here. I'm transferring an old repository to a monorepo and upgrading to Next.js v13. The published site is this https://piscina.ilikemartians.com. Shameless plug, I know 🤣 |
Glad to hear you got it resolved. It sounds like the issue is actually that we don't provide a CJS export anymore 😟 |
Out of curiosity, why is that? I mean, why don't you provide a CJS export anymore? Is it just a decision to move towards an ESM future or is there a technical issue that prevents you from being able to provide both? |
Any solution?( |
The solution rn is to convert your package type from Once you do that you can then add "module": "nodenext", in your If for some reason you can't convert to a module type package you can remove the |
I use js. Instead of ts config, i added in jsconfig |
From VS Code's
So you should still be able to declare this in there "module": "nodenext", |
Does anyone know what the solution for this is? I am also getting this issue when using the latest version of Phosphor Icons with Sanity. However everything works with the old For instance, when trying to launch a simple
Would be great to see a simple solution for a javascript project (without typescript). @milovangudelj does the |
Nope, it goes either in your This is necessary if you're trying to use an ESM-only package, and |
Hmm yeah that didn't work for me.. I may just post this issue on the Sanity forms tomorrow and see what the best approach is. I may just have to downgrade to the old version of Phosphor. Could be just my specific use case with Sanity 🤔 |
As I mentioned above that only works if you have set your package type to But this isn't possible for every type of application/package. Sanity requires you to use common js and switching is quite the hassle. I've tried doing that in the past with various degrees of success and you have to make compromises whichever way you chose to go. |
Yeah definitely. I appreciate the help! I'll update in this thread if a receive an answer tomorrow from the Sanity team. |
I've just published v2.0.8, which includes a UMD export (compatible with CJS build tooling), and does not specify import AddressBook from "@phosphor-icons/react/AddressBook"; // CAN'T DO THIS IN CJS ENVIRONMENT
import { AddressBook } from "@phosphor-icons/react"; // CAN DO THIS IN EITHER ENVIRONMENT |
I also recommend using the fully qualified path if you're doing modular imports (@phosphor-icons/react/dist/icons/Foo) |
@rektdeckard I just tested the latest update of |
Any other issues here, or safe to close? |
Everything is all good for me. Seems like the original issue is resolved as well @milovangudelj? |
I haven't had the chance to try it out yet but judging from what I've read so far it seems resolved. I'll close the issue for now. Feel free to reopen it if you find more errors related to this. |
Describe the bug
Using the latest version of the package (
v2.0.4
) along with esbuild and Next.js v13 this error pops up in the console when trying to import any icon from the library.Looking up the path reported I can see this entry
To Reproduce
It is quite the hassle, it invlolves setting up a monorepo with Turborepo and creating different apps and packages. If necessary I can provide a link to my repository.
Expected behavior
I expect the app to work without throwing any errors both in developement and production.
Desktop:
The text was updated successfully, but these errors were encountered: