stream-chat-react icon indicating copy to clipboard operation
stream-chat-react copied to clipboard

bug: Super expression must either be null or a function error

Open gimurpe opened this issue 3 years ago • 4 comments

Describe the bug

Getting "TypeError: Super expression must either be null or a function" after upgrading to version 7.0.0 To Reproduce

Steps to reproduce the behavior:

  1. Upgrade stream-chat-react to version 7.0.0

Expected behavior

No error is displayed

Screenshots

image

If applicable, add screenshots to help explain your problem.

Package version

  • stream-chat-react: 7.0.0
  • stream-chat-js: 6.7.2

Desktop (please complete the following information):

  • OS: [MacOS]
  • Browser [chrome]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [chrome]
  • Version [103.0.5060.53 (Official Build) (x86_64)]

Additional context

issue also occurred with version 9.1.4 , issue only occurs in production mode

gimurpe avatar Jun 29 '22 22:06 gimurpe

Hi @gimurpe ,

this is not a known issue. we will need additional information to reproduce the problem since it is likely related to additional customizations on your side. Can you replicate the problem by modifying this sandbox? You can also contact us at [email protected] if the reproduction is specific to your account or data.

petyosi avatar Jun 30 '22 05:06 petyosi

@petyosi I figured this is related to react-image-gallery introduced in version 7.0.0 : https://github.com/xiaolin/react-image-gallery/issues/624 .

gimurpe avatar Jun 30 '22 14:06 gimurpe

@petyosi We are having the exact same issue. The error does not show on a development build, but as soon as we build for production, react won't even load due to this error.

superCoderDOM avatar Jul 13 '22 14:07 superCoderDOM

@superCoderDOM how can we reproduce the problem on our side? Is this related to the image gallery from above?

petyosi avatar Jul 14 '22 04:07 petyosi

Can't reproduce, no reply from the issue author, closing for now.

arnautov-anton avatar Sep 07 '22 21:09 arnautov-anton

same issue @arnautov-anton Screenshot 2022-11-22 at 16 06 04

"react": "^16.9.0", "typescript": "^4.8.4", "@craco/craco": "^5.6.4",

im looking int this...

opengeekslabap avatar Nov 22 '22 14:11 opengeekslabap

@gimurpe fixed: problem was: after webpack minification package of stream-chat-react -> react-image-gallery was broken. solution:

disable optimization minimizer for react-image-gallery craco.config.js or webpack.config:


const applySplitChunks = (webpackConfig) => {
  webpackConfig.optimization.splitChunks = {
    chunks: 'all',
    maxInitialRequests: Infinity,
    minSize: 0,
    // https://stackoverflow.com/a/52961891
    cacheGroups: {
      vendor: {
        test: /[\\/]node_modules[\\/](react-image-gallery)[\\/]/,
        name(module) {
          const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
          return `npm.${packageName.replace('@', '')}`;
        },
      },
    },
  }

}

const applyOptimizationFilter = (webpackConfig) => {
  const skipMinimizationForChunk = [
    'npm.react-image-gallery'
  ]
  const terser = webpackConfig.optimization.minimizer.find(item => item.options.terserOptions);
  terser.options.chunkFilter = (chunk) => {
    return !skipMinimizationForChunk.includes(chunk.name);
  }
}

module.exports = {
  webpack: {
    configure(webpackConfig) {
     ...
      applySplitChunks(webpackConfig)
      applyOptimizationFilter(webpackConfig)
      return webpackConfig;
    }

Screenshot 2022-11-22 at 22 26 25

craco build serve -s build

opengeekslabap avatar Nov 22 '22 20:11 opengeekslabap

I'm getting this error when using React Native with Expo (latest SDK - 49) as well. 😢 Is there any way to fix it or workaround?

gabrielfurini avatar Jan 10 '24 18:01 gabrielfurini

Hey, @gabrielfurini - would you be able to share with us some sort of a repository with reproduction steps? Expo is no longer officially supported with this package (for that we have this stream-chat-expo package) but we could try and take a look if you can provide said repository.

arnautov-anton avatar Jan 11 '24 10:01 arnautov-anton

@arnautov-anton My mistake. The error was related to the stream-video-js package. The error message is the same, by the way. There is already a issue opened there: https://github.com/GetStream/stream-video-js/issues/1231

gabrielfurini avatar Jan 11 '24 14:01 gabrielfurini