-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
fix: treeshaking #10504
fix: treeshaking #10504
Conversation
Using esbuild? I think most others can shake assigning class properties (it can have side effects, but usually does not). I'm not against changing to static properties, but its a breaking change. |
@kurkle webpack with terser (default minifier, actually terser make tree-shake). Why it's braking change ? Public API stays the same. |
Changing es version can break things. |
@kurkle we can add, for example, swc to transpilation |
my test bench: https://github.com/dangreen/chartjs-treeshaking-test |
swc and even babel transpile it to side-effected code 😕 |
|
@kurkle Ok, it's breaking change, but it's a desirable and valuable fix. So what is the release plan? |
I think this is one big thing to drive towards v4. I think we need to do 3.8.1 and 3.9 first. There has been some talk on moving to typescript in v4 (does not need to be full conversion IMO, just the transpilation stuff and some part as POC so things can be converted in steps). But this ts thing could pushed forward to v5 too. |
@kurkle Got it. Thank you! |
I'd be open to getting through 3.8.1 and 3.9 quickly so that we can start on v4 dev. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Needs a consensus we want to move to static fields. I'm game.
Need some note(s) to migration guide, as the defaults move up from prototype and someone might be using those.
Edit: also needs a rebase
Will review this evening my time. |
…dataElementType as static props
Personally, I have no objection to using static properties. They look to be fairly well supported and users can use something like Babel if they need to support older browsers. So I'd be in favor of this change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. Have one concern with the category scale change
We need to merge these in some sane order to avoid tough rebases |
I have the article about that 🙂 https://dev.to/cubejs/why-and-how-to-transpile-dependencies-of-your-javascript-application-3phf |
Going to merge this first, then #10525 can be rebased |
fixes #10163
Before (build of each export):
After:
Assign properties to classes is a side effect, so that's why tree-shaking didn't work. Changed it to static properties.
Also, some calls (class constructors) are marked as pure.
Also added size-limit to control sizes of specific exports. Action is failing cause it should be in the base branch to compare sizes.