question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

I am getting this error after upgrading to webpack v4. Strangely this happens only in the prod build and not in dev build.

This is the stack-trace in browser console:

TypeError: Super expression must either be null or a function, not undefined
bundle-f82b2570e6fa0145fdb8.js:22:54086
n.withStyles/</n</<
http://localhost:8000/js/bundle-f82b2570e6fa0145fdb8.js:22:54086
n.withStyles/</n<
http://localhost:8000/js/bundle-f82b2570e6fa0145fdb8.js:22:54066
n.withStyles/<
http://localhost:8000/js/bundle-f82b2570e6fa0145fdb8.js:22:53698
<anonymous>
http://localhost:8000/js/bundle-f82b2570e6fa0145fdb8.js:36:433740
t
http://localhost:8000/js/bundle-f82b2570e6fa0145fdb8.js:1:105
<anonymous>
http://localhost:8000/js/bundle-f82b2570e6fa0145fdb8.js:84:260717
t
http://localhost:8000/js/bundle-f82b2570e6fa0145fdb8.js:1:105
<anonymous>
http://localhost:8000/js/bundle-f82b2570e6fa0145fdb8.js:84:263006
t
http://localhost:8000/js/bundle-f82b2570e6fa0145fdb8.js:1:105

I am actually using react-dates which is using this library. From stacktrace, I suspect this is where the error is coming from. Also removing react-dates makes the error to go away.

Here is my entire webpack config: https://gist.github.com/tejasbubane/9ae4d2e099bef97b3b118f99a163294e

Relevant libraries and their versions:

"react": "^15.6.1",
"react-dates": "^15.5.3",
"react-with-styles": "=2.2.0",
"webpack": "^4.12.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-polyfill": "^6.26.0",

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

16reactions
sunstorymvpcommented, Jul 3, 2018

For anyone who run into this issue setting keep_fnames: true for uglifyjs helps. Maybe because of this https://github.com/mishoo/UglifyJS2/issues/3015#issuecomment-375185061

5reactions
lencionicommented, Jun 21, 2018

Hard to say what might be happening here without more information.

According to this Stack Overflow post, it looks like this might happen if something extends React.component instead of React.Component. Do you think anything like that could be happening?

Could you post some of the code from your stack trace?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Super expression must either be null or ...
This means that you want subclass something, which should be Class , but is undefined . The ...
Read more >
React Errors : Super expression must either be null or a function
Have you come across this error when working with React? Uncaught TypeError: Super expression must either be null or a function, not undefined....
Read more >
React Errors : Super expression must either be null or a function
Firstly, if you're certain that you're extending from the correctly named class, e.g. React.Component, not React.component or React.
Read more >
TypeError: Super expression must either be null or a function ...
I got here just by googling the OP's error. In my case, the issue only appears when I run a 'release', minified build,...
Read more >
Uncaught TypeError: Super expression must either be null or ...
After making production build i am getting this error in console and application is not getting loaded. My Environment: OS: Linux/Ubuntu ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found