New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code transformed incorrectly #4960
Comments
just glancing over the repro, the outcome appears to be correct.
|
Yes, and since you never call |
yeah, but the original code is much bigger and more complicated. The |
In your original code, where is the place that updates |
have no idea, i'm using |
@lukastaegert from the first screenshot, which is being passed on to which might either get merged/extended by the passed in props |
exactly, i can add a proxy to find a place where callbacks are mutated, if we really need it |
Ah, thanks, I overlooked that. I fear we will need a better reproduction to dig into this. I don’t suppose you have a repository to share? Would also be interesting if Rollup 3.18.0 already had this issue or if 3.19.0 introduced it. It looks like _extends does not deoptimize its argument. |
What is the code of the |
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
} |
could you create a repository with a minimal repro @z4o4z ? otherwise it's nearly impossible to tell what's going on. |
That may not be needed, I think I figured it out. It is the use of This was not a problem prior to version 3.19.0 because here, call arguments were deoptimized by default, see here. I will see what I can do. |
Potential fix at #4965 |
This issue has been resolved via #4965 as part of rollup@3.21.1. You can test it via |
Rollup Version
3.21.0
Operating System (or Browser)
MacOS Version 13.3.1 (22E261)
Node Version (if applicable)
No response
Link To Reproduction
short example
I use library that has pretty weird code, it passes
callbacks
object into react components and other functions, and these components/functions mutate callbacks object. Other functions usescallbacks
object to perform some logic, but rollup dropscallbacks
from them. It introduces really weird issues in our product. The example link is not perfect one (it doesn't use the props object as an argument), but it shows exactly what happens in my production bundle . If remove initial nullable values from thecallbacks
object, all works fine.Expected Behaviour
Actual Behaviour
The text was updated successfully, but these errors were encountered: