webpack-contrib / uglifyjs-webpack-plugin

[deprecated] UglifyJS Plugin
MIT License
1.38k stars 179 forks source link

Uncaught TypeError: Cannot set property 'lastEffect' of null #393

Closed endze1t closed 5 years ago

endze1t commented 5 years ago

After upgrading React (to v16.8.1, from v16.7.0) and Webpack (to v4.29.2, from v4.28.4) to latest version: npm run build is no longer working. Building works without errors, but frontend crash with Uncaught TypeError: Cannot set property 'lastEffect' of null.

Builds are worked before together with uglifyjs-webpack-plugin. And with latest version without uglifyjs-webpack-plugin as well.

alexander-akait commented 5 years ago

I think problem in uglify-js, better use terser plugin (https://github.com/webpack-contrib/terser-webpack-plugin), anyway can you create minimum reproducible test repo?

endze1t commented 5 years ago

I wish i could deliver a reproducable, but this happens on a 3.5mb big output file. Not sure, on which component this happening. After uglifyjs file in webpack config the code is no longer readable.

I just tested it with terser and this is working. I'll go with terser in future then, thanks for letting me know about this plugin.

alexander-akait commented 5 years ago

@endbay maybe you comment/uncomment import and require to detect problem code for creating issue in uglify

endze1t commented 5 years ago

Looks like the Webpack & React upgrades wasn't the issue. I figured out this came from latest i18next-react @v10.0.0 (https://github.com/i18next/react-i18next). But this v10.0.0 is only for latest React version.

dcworldwide commented 5 years ago

@endbay I have the same stack. Upgrade react, i18n-next... broken. Is there a solution?

alexander-akait commented 5 years ago

@dcworldwide use terser-webpack-plugin

dcworldwide commented 5 years ago

Thank you.

theskillwithin commented 5 years ago

https://stackoverflow.com/questions/53348653/react-cannot-set-property-lasteffect-of-null

ammanvedi commented 5 years ago

same issue i can see error comes from a line where a hook is called i.e. useEffect(() => {

are you recommending terser as a quick fix or are you indicating that this wont get fixed in this package ?

alexander-akait commented 5 years ago

@ammanvedi uglify looks like abandoned, so we recommend switch to terser plugin, webpack@4 and webpack@5 by default use terser. I close this issue, because we can't fix it on our side, sorry. Solutions:

Thanks!