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

Use deep imports for date-fns to improve tree-shaking #1275

Merged
3 commits merged into from
Nov 4, 2022

Conversation

thgreasi
Copy link
Member

@thgreasi thgreasi commented Nov 4, 2022

Change-type: patch
See: https://balena.zulipchat.com/#narrow/stream/346007-balena-io.2FbalenaCloud/topic/moment.20-.3E.20date-fns
Signed-off-by: Thodoris Greasidis thodoris@balena.io

Resolves: #
HQ:
See:
Depends-on:
Change-type: major|minor|patch


Contributor checklist
  • Includes tests
  • Includes typings
  • Includes updated documentation
  • Includes updated build output

@thgreasi thgreasi changed the title Use deep imports for date-fns functions Use deep imports for date-fns to improve tree-shaking Nov 4, 2022
lib/util/date.ts Outdated
Comment on lines 1 to 2
// TODO: Remvove the deep imports once we start offering an esm build
// and confirm that tree-shaking date-fns still works.
Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I think that the CLI would benefit from a deep import, since it will always have to parse less files, regardless of switching to esm or not 🤔

Had to enable esModuleInterop, b/c
otherwise the date-fns/formatDistance import
not returning anything, even though TS was
happy.

Change-type: patch
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
@thgreasi
Copy link
Member Author

thgreasi commented Nov 4, 2022

@balena-ci I self-certify!

@ghost ghost merged commit 31778e5 into master Nov 4, 2022
@ghost ghost deleted the date-dns-deep-imports branch November 4, 2022 16:39
This pull request was closed.
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.

1 participant