-
Notifications
You must be signed in to change notification settings - Fork 325
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
[BUG] "@shopify/hydrogen doesn't appear to be written in CJS. Please contact the package author to fix" #341
Comments
Related Shopify/hydrogen#1155 |
Any ideas on how we can at least disable this error message? I thought #263 would fix this, but it does not 😢 @frandiox idea to drop CJS sounds appealing #1155 but we are blocked there. Would it be totally gross to capture |
[edit] Whoops my bad, I thought this was a different issue |
Hello, When I run I have the same problem than him : I did that : Do you have a solution for fixed that ? |
Hi all, We're developing a third party component library for use with Hydrogen and running into the same problem when we try to import anything from Our component library lists DemoThe third party component The third party component used inside of a Hydrogen app For now, the third party component library is packaged via ErrorsWhen running the app with And the dev server output shows:
Re: node module resolutionWe think this may be a module resolution issue. Our component library expects to use certain Hydrogen components, hooks, etc.. We compile our modules to both CJS and ESM and the user app resolves to our CJS modules, which are in turn attempting to resolve modules from Further investigation indicates that We tried setting the user app to use ESM module resolution and were met with the following error:
We tried to dig further into this but got lost in the weeds of Vite internals. For compatibility purposes and encouraging the growth of an ecosystem of third party libraries surrounding Hydrogen, could |
@susannepeng Hi! I think this problem is not due to the warning mentioned in this issue, so it would be better to create a new issue with this information. To answer your question, though: Hydrogen is used as ESM in Vite. If you were to import a CJS version of Hydrogen in your library, the user would end up with 2 different copies of that Hydrogen component. Plus, Vite itself and the ecosystem are moving towards ESM-first. I think the problem here is that your library is imported as CJS, and then it imports Hydrogen as ESM, right? Could you make sure your lib is imported as ESM instead? For that, I think you might need to provide ESM-only version and perhaps play with Vite's If that still doesn't work, please report this again as a new issue with your findings. |
@rafid-kore I think this is an unrelated issue. Could you create a separate issue? |
…pport Add better evicted cart support
Hello! If you are seeing this warning in your server console, please know that it is a red herring and is not affecting your development environment. We are working to resolve the warning, but please look for any other errors in your server console that could be causing an issue.
This started appearing in Vite 2.7.0. It is directly related to #263 which is blocked on other things.
This ticket is here to prevent duplicate tickets from appearing.
The text was updated successfully, but these errors were encountered: