jakezatecky / react-dual-listbox

A feature-rich dual listbox for React.
https://jakezatecky.github.io/react-dual-listbox/
MIT License
110 stars 58 forks source link

Uncaught TypeError: Super expression must either be null or a function on build #152

Closed sykes-mirandnf closed 1 year ago

sykes-mirandnf commented 3 years ago

Describe the bug Uncaught TypeError: Super expression must either be null or a function.

Reproduction steps I am currently using create-react-app 17 but after the build I encounter the error. But there is no problem with yarn start.

Expected behavior Should be working on build.

Screenshots image

joa2341 commented 3 years ago

The same thing happens to me. image

jakezatecky commented 3 years ago

Are you using the latest version of Webpack? Some people have noted that this appears to be a problem with TerserPlugin that create-react-app uses. I do not use create-react-app personally, but some people have noted that setting keep_fnames: true fixes the issue for them. Therefore, setting your webpack.config.js to something like this may solve your issue:

module.exports = {
  ...

  optimization: {
    minimizer: [
      new TerserPlugin({
        terserOptions: { keep_fnames: true },
      }),
    ],
  },
};
sykes-mirandnf commented 3 years ago

CRA has built-in webpack, I am not sure yet if I can have custom module.exports fot that.

takeruadelbert commented 2 years ago

@sykes-mirandnf @jakezatecky Hi, I encounter the exact same problem. Do you get it work?

jakezatecky commented 2 years ago

I do not know what in CRA causes the issue but I recall from back when this issue was opened that I played around with it and got some similar, unusual errors. Unfortunately CRA does a lot of heavy lifting and it is not immediately clear what causes the issue with any code it runs.

jakezatecky commented 1 year ago

I just tested with a new app created with create-react-app v5.0.1 and react-dual-listbox v3.0.1. It does not appear that this issue occurs anymore.