React-dates: Uncaught TypeError: Super expression must either be null or a function, not undefined

Created on 7 Nov 2018  路  15Comments  路  Source: airbnb/react-dates

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)

Most helpful comment

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

All 15 comments

In what browser? There鈥檚 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.

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.

And to confirm, you鈥檙e not running node_modules through babel?

It's excluded from babel.

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.

Definitely that鈥檚 a good change to make; but it shouldn鈥檛 be affecting this. It might be a bug in uglify.

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.

Can you try 18.2.1?

Still an issue in 18.2.1

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

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

@danjumamilhaus what version of React are you using?

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

Tested using React v16.4.1

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Adam-Pendleton picture Adam-Pendleton  路  3Comments

krissalvador27 picture krissalvador27  路  3Comments

ekohanyi picture ekohanyi  路  3Comments

yokomizor picture yokomizor  路  3Comments

mrseanbaines picture mrseanbaines  路  3Comments