-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Tree-shaking of D3 broken since 0.50. #1707
Comments
Looking a little closer at the generated code, it appears to have something to do with the use of the comma operator: var value0 = styleValue(this, name),
value1 = value(this);
if (value1 == null) value1 = (this.style.removeProperty(name), style(this, name)); Notice that the first reference to |
Thanks for providing a repo and digging into this, this is very helpful! Just a question: Is this happening for 0.50.0 as well as 0.50.1 or just for the latter? There have been some changes to sequence (i.e. comma) expression handling in 0.50.1. |
In my testing it appeared broken in 0.50.0, 0.50.1 and 0.51.0. I will investigate further today as I have time. Thanks for looking into this and the prompt response! (Also, very excited that you are working on tree-shaking improvements. Thank you!) |
I think this is the same issue I found in #1709. Bisecting lead me to 0.50.1, and I believe it has to do with variable names not being tracked correctly in SequenceExpressions. I have a minimal Rollup repl that shows this problem in that issue. |
Here's another example of the issue when including Redux-Immutable: var _utilities = require('./utilities');
(0, _utilities.validateNextState)(nextDomainState, reducerName, action);
|
Reproduction here:
https://bl.ocks.org/mbostock/40e26f283013422491ca475e2513b08c
The crash occurs on this line in transition.style:
https://github.com/d3/d3-transition/blob/d894452ffd3ff69effe1eb1fdfcb5fd9236ba8f3/src/transition/style.js#L12
It’s trying to reference d3.style imported from d3-selection, but for some reason the import is ignored. Maybe it’s because d3-selection is also imported by the entry index.js, but d3.style is only used internally by d3-transition? I’ll try to reduce this to a smaller test case.
The text was updated successfully, but these errors were encountered: