mhnpd / react-loader-spinner

Collection sets of a spinners for async operations for ReactJS
https://mhnpd.github.io/react-loader-spinner/
MIT License
969 stars 145 forks source link

Error on build app when importing any component #159

Closed pauloricardos closed 9 months ago

pauloricardos commented 9 months ago

Hello folks, how are you?

I'm facing an issue here: when I import a component from the library, for example the Audio component, when i build my application, throws the following error:

import { Oval } from "react-loader-spinner";
         ^^^^
SyntaxError: Named export 'Oval' not found. The requested module 'react-loader-spinner' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'react-loader-spinner';
const { Oval } = pkg;

Here's how I'm importing it:

import { Oval } from 'react-loader-spinner';

<Suspense
          fallback={
            <Oval
              height="100"
              width="100"
              color="#4fa94d"
              ariaLabel="audio-loading"
              wrapperStyle={{}}
              wrapperClass="wrapper-class"
              visible={true}
            />
          }
        >

It's not clear for me which problem is. I'm using Remix v2 and Bun 1.0.15. My package.json has the type as module specified.

Thanks in advance

jfacoustic commented 4 weeks ago

@mhnpd This is occurring for me as well. I'm using remix and react-loader-spinner 6.1.6.

https://publint.dev/react-loader-spinner@6.1.6 shows the error.