react-image-gallery icon indicating copy to clipboard operation
react-image-gallery copied to clipboard

Issue in Production build

Open nitiandiv opened this issue 2 years ago • 19 comments

Describe the bug Issue in Production build

To Reproduce Steps to reproduce the behavior: created bundle and deploy

Expected behavior it should open shown w/o any error

Desktop (please complete the following information): issue started coming in 1-2 days

react_devtools_backend.js:2574 TypeError: Super expression must either be null or a function at image-gallery.js:1094 at image-gallery.js:1093 at image-gallery.js:1092 at image-gallery.js:375 at Object. (image-gallery.js:4) at Object.1311 (image-gallery.js:4) at b (jobList?challenge_id=6114cddd5c90a30008b69f09:14) at Module.1338 (videoPart.js:114) at b (jobList?challenge_id=6114cddd5c90a30008b69f09:14) overrideMethod @ react_devtools_backend.js:2574 is @ react-dom.production.min.js:5058 r.callback @ react-dom.production.min.js:5568 da @ react-dom.production.min.js:3108 us @ react-dom.production.min.js:5182 (anonymous) @ react-dom.production.min.js:6408 t.unstable_runWithPriority @ scheduler.production.min.js:309 jn @ react-dom.production.min.js:2816 Nu @ react-dom.production.min.js:6204 cu @ react-dom.production.min.js:5895 (anonymous) @ react-dom.production.min.js:2851 t.unstable_runWithPriority @ scheduler.production.min.js:309 jn @ react-dom.production.min.js:2816 Qn @ react-dom.production.min.js:2846 U @ scheduler.production.min.js:203 T.port1.onmessage @ scheduler.production.min.js:94

Additional context Add any other context about the problem here.

nitiandiv avatar Aug 12 '21 10:08 nitiandiv

This looks like a duplicate of #621. Can you explain a little more? The stack trace doesn't help much here. Are you able to get the component working in a development build?

xiaolin avatar Aug 12 '21 21:08 xiaolin

For what it's worth, the demo site is using a latest production build of react-image-gallery.

https://www.linxtion.com/demo/react-image-gallery/

xiaolin avatar Aug 12 '21 21:08 xiaolin

I am currently having this same issue. The image gallery runs perfect locally, but when I try to deploy it I get the 'TypeError: Super expression must either be null or a function' error and I can only see the background color of the page, no components.

ThatSkiPatroller avatar Sep 09 '21 09:09 ThatSkiPatroller

I got same error in production build

jobindcruz avatar Sep 09 '21 10:09 jobindcruz

Is there any issues with your imports? See https://stackoverflow.com/questions/30116430/reactjs-giving-error-uncaught-typeerror-super-expression-must-either-be-null-or

xiaolin avatar Sep 09 '21 17:09 xiaolin

Face the same issue on a production build. Is there any solution found? I tried all the possibilities from the above link. Nothing can make work on it. Thanks in advance

Anilkumar18 avatar Sep 24 '21 05:09 Anilkumar18

I'm also having the same issue.

My issue got solved by downgrading the node version to 10.16.3

Muhzn avatar Oct 26 '21 09:10 Muhzn

I'm seeing this same issue, seems to only occur when webpack minimize is enabled.

In webpack.config.js

optimization: {
  minimize: true,
}

jyelewis avatar Dec 06 '21 19:12 jyelewis

Any solution? I have the same issue

jeferbc avatar Dec 23 '21 17:12 jeferbc

Any help or solution? Same issue here

T0to22 avatar Mar 17 '22 17:03 T0to22

Same issue here

TomlDev avatar Apr 26 '22 10:04 TomlDev

Same issue here, who have good idea?

hu-milize avatar May 22 '22 02:05 hu-milize

Same issue. Using create-react-app straight up, no ejected code. Looks like this project is abandoned.

BuckeyeCoder avatar Jun 21 '22 08:06 BuckeyeCoder

There is a "can't replicate" label on this issue, if anyone can provide clear steps to reproduce It will help debug and solve this issue.

xiaolin avatar Jun 21 '22 17:06 xiaolin

@xiaolin I think you can try with node 14.8.0 and webpack minimize enabled.

In webpack.config.js

optimization: {
  minimize: true,
}

gimurpe avatar Jun 30 '22 15:06 gimurpe

@xiaolin I can confirm that after disabling webpack minimize the issue stoped occurring

gimurpe avatar Jun 30 '22 15:06 gimurpe

If you don't want to disable the minimize property you can make this work with the following code:

Useful links: terser-webpack-plugin webpack optimization minimize

npm install terser-webpack-plugin --save-dev for webpack v5 npm install [email protected] --save-dev for webpack v4

webpack.config.js

const TerserPlugin = require('terser-webpack-plugin');

  optimization = {
    minimize: true,
    minimizer: [new TerserPlugin({ exclude: /\/node_modules\/react-image-gallery/ })],
  };

or

config-overrides.js

const TerserPlugin = require('terser-webpack-plugin');

config.optimization = { minimize: true, minimizer: [new TerserPlugin({ exclude: /\/node_modules\/react-image-gallery/ })], };

gimurpe avatar Jun 30 '22 15:06 gimurpe

Same issue.

superCoderDOM avatar Jul 13 '22 14:07 superCoderDOM

Same issue. Seeing the comments above to add optimization: { minimize: true, } how to add this object with the new React v18?

PriyaJainDev avatar Aug 05 '22 18:08 PriyaJainDev

Same issue...

iamarturr avatar Sep 27 '22 19:09 iamarturr

Same here

Murtala-1 avatar Oct 09 '22 21:10 Murtala-1

Closing this as steps to reproduce is not clear and there are many instances of this lib in production. If you're able to reproduce with this package isolated please list steps and repopen.

xiaolin avatar Oct 10 '22 00:10 xiaolin

In case someone will bump here in search for any solution but "disable minimizing at all" - I can confirm that @gimurpe 's one works like charm (tested for Webpack 4). Thank you a lot, camarade!

greenais avatar Nov 23 '22 05:11 greenais

FWIW, I tried to reproduce using the config below and was not able to replicate the issue, is it isolated to webpack < 5??

package.json

"react-image-gallery": "^1.1.1",
"terser-webpack-plugin": "^5.3.6",
"webpack": "^5.30.0",

webpack.config.js

  optimization: {
    minimize: true,
    minimizer: [new TerserPlugin()],
  },

xiaolin avatar Dec 04 '22 06:12 xiaolin

here is what fixed it for me, thank you @gimurpe

config-overrides.js

const TerserPlugin = require('terser-webpack-plugin');

module.exports = function override(webpackConfig) {
    webpackConfig.optimization = 
      {
        minimize: true,
        minimizer: [new TerserPlugin({ exclude: /\/node_modules\/react-image-gallery/ })],
      }
    return webpackConfig;
  }

package.json

"terser-webpack-plugin": "^4.2.3",
"webpack": "^4.28.3"

few things to mention:

  1. the image gallery was working fine locally but not in production
  2. installed terser webpack plugin without --save-dev
  3. was getting webpack version issues but added SKIP_PREFLIGHT_CHECK=true to .env

00simba avatar Dec 04 '22 06:12 00simba

I confirm that minification causes this, but it's a random issue. I'm working for a year on a project and now after a rebuild it just throw this error.

Infortunatelly @gimurpe workaround cannot fix here.

Removing the import to this pacakge stops the error, don't occur on dev, only on production minfiied.

iget-master avatar Sep 22 '23 17:09 iget-master