Bug report or feature request?
Bug report
Uglify version (uglifyjs -V)
[email protected] (via [email protected])
The following is React-DOM's 16.7.0-alpha code for pushing updates to their Component Update Queue (in React Fibre):
JavaScript input
function Gg(a, b, c, d) {
a = {
tag: a,
create: b,
destroy: c,
inputs: d,
next: null
};
null === R ? (R = {
callbackList: null,
lastEffect: null
}, R.lastEffect = a.next = a) : (b = R.lastEffect, null === b ? R.lastEffect = a.next = a : (c = b.next, b.next = a, a.next = c, R.lastEffect = a));
return a
}
The uglifyjs CLI command executed or minify() options used.
All the default options
JavaScript output or error produced.
function Vo(e, t, n, r) {
return e = {
tag: e,
create: t,
destroy: n,
inputs: r,
next: null
},
jo.lastEffect = null === jo ? (jo = {
callbackList: null,
lastEffect: null
},
e.next = e) : null === (t = jo.lastEffect) ? e.next = e : (n = t.next,
(t.next = e).next = n,
e),
e
}
The error is trying to set lastEffect on the jo object, which has not yet been defined. Perhaps a result of UglifyJS trying to reduce the return statement?
Related Issues:
https://github.com/facebook/react/issues/14014
https://github.com/webpack-contrib/uglifyjs-webpack-plugin/issues/374
Does it work with terser?
Hi @kzc, yep, it works with terser!
Unable to independently confirm that. Cannot reproduce the issue in [email protected] with input provided and default minify options.
@z4o4z terser worked great for me, thank you!
@kzc The uglification was done through uglifyjs-webpack-plugin with default minify options on the entire React-DOM 16.7.0-alpha code.
Using uglifyjs directly on just the function doesn't seem to produce this issue. Hmm, I guess it must be something else in the file...
Have this issue @starbucks as well, will be moving to terser.
@alexlamsl Why did you close it?
@mgol the non-reproducible test case looks like #3271 etc., which is fixed by #3329
I can confirm that terser has no this issue.
Most helpful comment
Hi @kzc, yep, it works with
terser!