Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Super expression must either be null or a function, not undefined #1456

Closed
danjumamilhaus opened this issue Nov 7, 2018 · 15 comments

Comments

@danjumamilhaus
Copy link

danjumamilhaus commented Nov 7, 2018

Getting error this in a production environment, while local dev works without issues.
Using react-dates 18.2.0 18.2.1

Uncaught TypeError: Super expression must either be null or a function, not undefined
    at withStyles.js:44
    at withStyles.js:44
    at withStyles.js:158
    at Object.<anonymous> (CalendarDay.js:276)
    at o (bootstrap:78)
    at Object.<anonymous> (index.js:207)
    at o (bootstrap:78)
    at Object.<anonymous> (index.js:2)
    at o (bootstrap:78)
    at Object.<anonymous> (sn.hd.product.js:53)
@ljharb
Copy link
Member

ljharb commented Nov 7, 2018

In what browser? There’s a known issue in 18.2.0 in IE 9-11, due to a bug in babel around inheritance hierarchies. 18.2.1 fixes it, and 18.2.2 will fix #1455.

@danjumamilhaus
Copy link
Author

danjumamilhaus commented Nov 7, 2018

Chrome v70. Also an issue in v69. Happening for other users in Chrome, not sure their versions. Error is happening in Firefox v63 as well.

@ljharb
Copy link
Member

ljharb commented Nov 7, 2018

And to confirm, you’re not running node_modules through babel?

@danjumamilhaus
Copy link
Author

It's excluded from babel.

@danjumamilhaus
Copy link
Author

danjumamilhaus commented Nov 7, 2018

So, I seem to have solved this in our case at least.

In our production webpack task, we are using the uglify-webpackjs-plugin.

Adding the lines:

uglifyOptions: {
  keep_fnames: true
},

keep this error from happening in that environment.

Possibly some food for thought on why this issue is happening in the future.

@ljharb
Copy link
Member

ljharb commented Nov 7, 2018

Definitely that’s a good change to make; but it shouldn’t be affecting this. It might be a bug in uglify.

@danjumamilhaus
Copy link
Author

Unfortunately it's not a viable change since we would like to not turn this on across the site. It seems to only be an issue within this library, specifically within CalendarDay.js.

@ljharb
Copy link
Member

ljharb commented Nov 7, 2018

Can you try 18.2.1?

@danjumamilhaus
Copy link
Author

danjumamilhaus commented Nov 7, 2018

Still an issue in 18.2.1

@danjumamilhaus
Copy link
Author

In this case, the superClass React.PureComponent is undefined.
image

@Dodie324
Copy link

Dodie324 commented Nov 7, 2018

We're also experiencing this error in our application code base.

@ljharb
Copy link
Member

ljharb commented Nov 7, 2018

@danjumamilhaus what version of React are you using?

@danjumamilhaus
Copy link
Author

Ultimately, upgrading uglifyjs-webpack-plugin to v2.0.1 from v1.2.7 solved this issue. Found the info I needed starting here: facebook/react#13987 (comment) in case some lone traveler is interested.

@danjumamilhaus
Copy link
Author

danjumamilhaus commented Nov 7, 2018

Tested using React v16.4.1

@muganwas
Copy link

muganwas commented Mar 2, 2020

I had this error, turns out i had misspelled Component, i had written Class blabla extends React.Compnent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants