Giter Site home page Giter Site logo

Compatibility with Astro framework about react HOT 5 CLOSED

pReya avatar pReya commented on April 29, 2024
Compatibility with Astro framework

from react.

Comments (5)

rektdeckard avatar rektdeckard commented on April 29, 2024 2

Thanks @pReya for flagging, and @adamtaylor13 for the fix and for the lovely writeup! v2.0.10 had been published with the type field added.

from react.

adamtaylor13 avatar adamtaylor13 commented on April 29, 2024

@pReya I'm running into this as well. I took a look at your example, and it only actually seems to show the error once I added Smiley to the IconContainer—simply importing it did not seem to reproduce. I'm very curious what changed as well, because the legacy phosphor-react library worked fine with Astro.

Things I've tried

  • Switching all imported instances of my react components to "client:only" directives so they aren't server-side rendered.
  • Adding "use client" to my icon imports.
  • Changing my package.json to "type": "module", to no avail.
  • Adding "module": "nodenext", to my tsconfig.json
  • All the above in various orders / combinations.

All to no avail unfortunately. I'm going to just have to downgrade to using phosphor-react for right now.

from react.

pReya avatar pReya commented on April 29, 2024

A workaround for me is currently to use the raw svg files and import them with https://github.com/pd4d10/vite-plugin-svgr as React components.

This problem might be fixed just by adding type: "module" to the package.json of the @phosphor-icons/react package.

from react.

adamtaylor13 avatar adamtaylor13 commented on April 29, 2024

This problem might be fixed just by adding type: "module" to the package.json of the @phosphor-icons/react package

@pReya Wow, no kidding, this fixed it!

from react.

adamtaylor13 avatar adamtaylor13 commented on April 29, 2024

Just in case my PR doesn't go through, I wrote a small blog post about how I'm implementing this for now without needing to use the vite plugin: https://adamtaylor.me/posts/fixing-a-minor-inconvenience-with-phosphor-icons/

from react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.