jakezatecky/react-dual-listbox

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

Closed this issue · 6 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

The same thing happens to me.
image

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

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

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

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.

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.