-
Notifications
You must be signed in to change notification settings - Fork 525
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: Refactor export default {}
objects to one-off exports.
#650
Comments
Hi @ryan-roemer! We're a small group of Computer Science students from KTH (Stockholm, Sweden). We'd like to tackle this issue as part of a school assignment to contribute to an open source project. Can you assign me to it? Also, is there anything else we should know before we begin, that's not stated in the |
@beccanelson and I were chatting Victory + Lodash + tree-shaking today, and in checking out https://github.com/FormidableLabs/victory/blob/main/packages/victory-core/src/victory-util/helpers.js#L307-L327 I noticed a huge default export that can't be tree-shaken: export default {
omit,
getPoint,
scalePoint,
getPadding,
getDefaultStyles,
getStyles,
evaluateProp,
evaluateStyle,
degreesToRadians,
radiansToDegrees,
getRadius,
getPolarOrigin,
getRange,
createAccessor,
modifyProps,
getCurrentAxis,
reduceChildren,
isHorizontal,
isTooltip
}; Maybe we want to do a quick assessment of size impact and number of files where we could slim things down? |
@ryan-roemer @boygirl I can re-open this issue - it looks like there are several files in Based on the initial research I have done, it sounds like we can namespace these files, and still support tree-shaking. This means that instead of As far as I know, we can also use Other than changing a few imports (and adding function exports to the utils), this shouldn't require many changes to the code itself. Does this sound reasonable? |
@beccanelson That sounds like a good course of action. Thank you! |
Background
Tree shaking relies on named specific exports and can't pick from mega objects. Throughout our victory repos code we have patterns like:
which we should refactor to:
Task
export default {}
that are actually individual objects / vars we should individually exportThe text was updated successfully, but these errors were encountered: