react-dual-listbox icon indicating copy to clipboard operation
react-dual-listbox copied to clipboard

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

Open sykes-mirandnf opened this issue 3 years ago • 5 comments

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

sykes-mirandnf avatar Jul 09 '21 18:07 sykes-mirandnf

The same thing happens to me. image

joa2341 avatar Jul 12 '21 06:07 joa2341

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 },
      }),
    ],
  },
};

jakezatecky avatar Jul 12 '21 15:07 jakezatecky

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

sykes-mirandnf avatar Jul 12 '21 15:07 sykes-mirandnf

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

takeruadelbert avatar Feb 08 '22 13:02 takeruadelbert

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 avatar Feb 15 '22 22:02 jakezatecky

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.

jakezatecky avatar Nov 04 '22 05:11 jakezatecky