wingkwong / react-quiz-component

:orange_book: React Quiz Component
https://wingkwong.github.io/react-quiz-component/
MIT License
370 stars 142 forks source link

Support for ECMAScript Modules #150

Closed matthewbcool closed 10 months ago

matthewbcool commented 11 months ago

react-quiz-component library may not be fully compatible with Astro or Vite's module system out of the box.

Astro uses Vite as its internal build engine, which supports ESM (ECMAScript Modules). However, not all npm packages support ESM. If the react-quiz-component library doesn't support ESM, you might need to adjust your vite config for it to work. Astro tries to convert the package to ESM so that import statements work (source (https://docs.astro.build/en/guides/imports/)).

wingkwong commented 11 months ago

@matthewbcool can you ping me at Discord for the discussion?

matthewbcool commented 11 months ago

@matthewbcool can you ping me at Discord for the discussion?

Thank you kindly for taking a look, unfortunately, I'm not able to connect with you using that discord link.

Apologies if this issue lacks context, I don't deeply understand the root issue.

I tried troubleshooting the issue in Astro's server with more details in a thread here.

Happy to discuss the issue more to see where I can help and appreciate any suggestions you can give.

wingkwong commented 11 months ago

Just ping you at Discord.

matthewbcool commented 10 months ago

Resolved. Thanks @wingkwong.

For folks using Astro with mdx, use an astro file to import the component and don't forget to use the custom attribute client:only="react" when you import into the .astro file. e.g: <YourQuiz client:only="react"/>