spinners-react icon indicating copy to clipboard operation
spinners-react copied to clipboard

SpinnerCircularFixed does not exist?

Open mattfelten opened this issue 1 year ago • 2 comments

I had an issue with SpinnerCircularFixed before but I'm having an even weirder one now. My build is saying it doesn't even exist.

The requested module 'spinners-react' does not provide an export named 'SpinnerCircularFixed'

I put together a demo here of a basic Astro project, installed this package and used it. You can see the error. https://github.com/mattfelten/test-spinners

I'm really not sure why since I see the package in node_modules and have looked through the files there. Not sure if this is an issue with Astro/Vite or somethings odd here, so figured I'd share.

mattfelten avatar Jan 24 '25 23:01 mattfelten

This might be an issue with Astro or Vite, so I posted this issue there as well https://github.com/withastro/astro/issues/13066

mattfelten avatar Jan 24 '25 23:01 mattfelten

Please, check this workaround out.

Updating astro.config.mjs to this:

import { defineConfig } from "astro/config";

// https://astro.build/config
export default defineConfig({
  vite: {
    ssr: {
      noExternal: ["spinners-react"],
    },
  },
});

seems to fix the issue.

Note that since you're using server-side rendering you'd need to inject styles manually:

---
...
import { SpinnerCircularFixed } from 'spinners-react';
import 'spinners-react/lib/index.css';
---

<Layout>
	<SpinnerCircularFixed />
	<Welcome />
</Layout>

adexin-team avatar Apr 27 '25 18:04 adexin-team