flexdinesh / react-socks

🎉 React library to render components only on specific viewports 🔥
MIT License
426 stars 29 forks source link

TypeError: Super expression must either be null or a function #31

Closed admapop closed 5 years ago

admapop commented 5 years ago

The react website I'm building at the moment is throwing this error in the console.

It works just fine on localhost, but as soon as I deploy it to Netlify, the page is blank and I get this error in console pointed at react-socks/dist/index.js

I have no idea what could be causing this and why it gets triggered only in production.

dbryantm commented 5 years ago

I noticed this also since the release of 2.1.0 so I've reverted back to 2.0.2 for the time being though I've discovered it definitely affects apps using CRA and during the build script.

react: 16.9.0
react-dom: 16.9.0
react-scripts: 3.1.1
wileymc commented 5 years ago

I am also getting this error with v2.1.0 with a CRA build. I'm going to revert to 2.0.2 and see if I have any luck.

flexdinesh commented 5 years ago

@admapop @dbryantm @wileybaba I added the project to a new create-react-app and tried to build it and couldn't see any error. Is this error Netlify specific or does it happen when you build the project in local?

This is what I tried —

  1. new create-react-app
  2. add react-socks and an Example component that uses it
  3. Run yarn build
  4. Serve locally with http-server with the command http-server build -c-1
dbryantm commented 5 years ago

@flexdinesh, looks like some release of CRA/React seems to fix the issue. Not sure of the exact version that would correct what we were experiencing from before though. I'm currently on the following:

react: 16.11.0
react-dom: 16.11.0
react-scripts: 3.2.0

When I was still experiencing the mentioned issue I was on the following:

react: 16.9.0
react-dom: 16.9.0
react-scripts: 3.1.1

You might want to attempt installing those specific versions and see if you're able to reproduce? The short term answer would definitely be to encourage people to upgrade if possible. Could you try this @admapop and @wileybaba? Thanks in advance!

wileymc commented 5 years ago

I update react and react-dom to 16.11.0 and my build is now working with react-socks 2.1.0. My suspicion is that the error was coming from something within the build process in CRA

flexdinesh commented 5 years ago

Thanks for the confirmation @dbryantm @wileybaba. Glad things are working fine for you now. I'm gonna close this issue.

tonytoth commented 5 years ago

I had the same issue and it worked for me with these versions: "[react](https://npmjs.com/package/react)": "^16.11.0", "[react-dom](https://npmjs.com/package/react-dom)": "^16.11.0", "[react-socks](https://npmjs.com/package/react-socks)": "2.0.2", Thank you very much guys !

rus-yurchenko commented 5 years ago

Same issue with

react: 16.12.0
react-dom: 16.12.0
react-socks: 2.1.0