Skip to content
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

Only import lodash's sortBy method #2858

Merged
merged 5 commits into from
Oct 3, 2020

Conversation

paulcam206
Copy link
Member

Description

Instead of importing all of lodash in functionUtils.internal.ts, import only the sortBy method, which is the only one needed.

Testing

Already covered by existing sortBy tests (which pass).

@paulcam206 paulcam206 requested a review from a team as a code owner October 1, 2020 20:51
@paulcam206
Copy link
Member Author

My goal here is to hopefully eventually reduce package sizes by restricting imports to what's being used.

@@ -9,7 +9,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { Constant } from './constant';
import * as lodash from 'lodash';
import { sortBy as lodashSortBy } from 'lodash';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will be more effective: https://stackoverflow.com/questions/35250500/correct-way-to-import-lodash

Feel free to verify that this gives the expected package size reductions.

Copy link
Contributor

@joshgummersall joshgummersall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@stevengum stevengum merged commit 981699a into microsoft:main Oct 3, 2020
@paulcam206 paulcam206 deleted the paulcam/limit-lodash branch October 5, 2020 17:06
@paulcam206
Copy link
Member Author

thanks everyone! 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants