react-confetti: Error: Super expression must either be null or a function

I’m having the same issue someone else reported here: Stackoverflow

This is in a Next.js project and there are no problems when running in local development. This only happens when the production build is created so I’m not sure if something in the minification process is causing the problem?

Downgrading to 4.0.1 appears to resolve the issue.

Dependencies:

    "react": "^16.9.0",
    "react-confetti": "4.0.1",
    "react-dom": "^16.10.2",

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 10
  • Comments: 21 (1 by maintainers)

Commits related to this issue

Most upvoted comments

@alampros Are you even here or do we need to fork this?

@alampros any luck with this?

Thanks for reporting this issue! I’ll take a look at it tomorrow.

Good point stale bot. Forked the project here, overhauled the build/publication process and actively accepting PRs:

https://github.com/rkuykendall/confetti-react

@alampros It seems that something has gone wrong in the build process when the 5.0.1 version was published to npm. When I run the build command in the react-confetti repository on my machine it produces a different minified script than the one that is provided when installing the package.

Perhaps a solution is to simply try publishing the package again? Making sure that the correct minified file is generated.


Workaround In case anyone simply wants a quick workaround. You can import the unminified dist file instead of the minified (and apparently corrupted) file.

- import Confetti from 'react-confetti';
+ import Confetti from 'react-confetti/dist/react-confetti';

I’m also hitting this same error in production. 0.5.1. Downgraded to 0.4.1 fixe the issue.

correction: 5.0.1. Downgraded to 4.0.1

Here is what I had

<Confetti numberOfPieces={333} recycle={false} />

At least as of 6 days ago this didn’t work in production with the latest version but did work locally. Downgrading fixed the production issue.