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

Vite + React encountered Uncaught TypeError: Super expression must either be null or a function

Open weeliem opened this issue 2 years ago • 4 comments

Hi, i’m encountered this error when using Vite + React Moralis. This error is not happening when using webpack (npx create-react-app) and only occured when using vite.

main.jsx: image

Error: image

weeliem avatar Apr 05 '22 09:04 weeliem

We have seen several issues with Vite apps. It might be because of the way they handle EsModules.

It might be solvable by configuring the app, but my knowledge of Vite is limiting unfortunately.

We will look into better out-of-the-box support for Vite apps, or provide boilerplate for it in the future

ErnoW avatar Apr 13 '22 01:04 ErnoW

A quick way to fix this is by adding events as a dev dependency by running yarn add -D events or npm i --save-dev events and that should get that fixed.

Qudusayo avatar Apr 14 '22 02:04 Qudusayo

@Qudusayo Thanks mate! I had the same issue and your solution magically solved it.

masafumimori avatar May 16 '22 05:05 masafumimori

A quick way to fix this is by adding events as a dev dependency by running yarn add -D events or npm i --save-dev events and that should get that fixed.

Thank you @Qudusayo, this issue made me scratch my head a bit😂, and hopefully they could fix this issue soon

MyNameIsTakenOMG avatar May 21 '22 19:05 MyNameIsTakenOMG