Skip to content

pref():import lodash efficiently#1446

Merged
kamilmysliwiec merged 1 commit intonestjs:masterfrom
thematan:import-lodash-efficiently
Aug 31, 2023
Merged

pref():import lodash efficiently#1446
kamilmysliwiec merged 1 commit intonestjs:masterfrom
thematan:import-lodash-efficiently

Conversation

@thematan
Copy link
Copy Markdown
Contributor

this is the recommended way to load only the methods needed instead of entire lodash.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

lodash is imported entirely in to the package. when most of it not needed at all.
it makes 78.3% of the bundle!

Issue Number: N/A

What is the new behavior?

imports only the relevant methods. This is the recommended way to pick methods from lodash.
This improves pull request 792, which moved to using the full lodash package,
but made inefficient imports.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

pull request improved: #792
article about importing lodash: https://www.labnol.org/code/import-lodash-211117

this is the recommended way to load only the methods needed instead of entire lodash.
@thematan thematan force-pushed the import-lodash-efficiently branch from 15685c1 to 5f267d1 Compare August 30, 2023 19:05
@kamilmysliwiec kamilmysliwiec merged commit 5cc7553 into nestjs:master Aug 31, 2023
@kamilmysliwiec
Copy link
Copy Markdown
Member

lgtm

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