feat: remove lodash dependency #743
No reviewers
Labels
No Label
area/internal-code
changes requested
confirmed
dependencies
duplicate
good first issue
help wanted
hosting
invalid
kind/bug
kind/feature
question
wontfix
No Milestone
No project
No Assignees
2 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#743
Loading…
Reference in New Issue
No description provided.
Delete Branch "dpschen/frontend:feature/remove-lodash"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This should work on its own but makes more sense to merge after #752 .
Lodash is quite big and all helpers got imported even thought not all needed. With new JS syntax it's
easypossible to replace most helpers.544ee041a3
to0828cf8eb0
0828cf8eb0
to2179c0dcca
2179c0dcca
to8399f96c3d
8399f96c3d
to9e3e970d3a
Okay, somethink still doesn't work. I can't get cypress to run locally. Will keep this as is for now.
9e3e970d3a
to5b8502603b
Since lodash is tree-shakable and we're only importing what's required, how big is the difference this makes in the final bundle size?
It won't make a large difference. I'm not sure lodash was correctly tree shaken before. Either way I think it makes sense to use ES features where they replace lodash 1 to 1. My option in this regard goes in the direction of this article: https://thejs.dev/jmitchell/its-time-to-let-go-of-lodash-nqc
I'm leaving this branch open aswell until vue 3 is finished.
5b8502603b
todb3a502837
db3a502837
to6fb77ad3b7
6fb77ad3b7
tofc267dc644
fc267dc644
to724e776fef
724e776fef
to6c8ec65c6e
6c8ec65c6e
to2d80d08d7a
WIP: feat: remove lodash dependencyto feat: remove lodash dependency@konrad here we go :)
I hope this can mitigate some problems I currently have with the vue 3 branch.
2d80d08d7a
tod9f2d879d7
Interesting to compare the bundle sizes before and after:
Before:
After:
So while it did save some bytes, the overall difference in bundle size is not that big.
Thanks for the effort!
Around 10kb gzipped js is a lot.
Might be that we need to put some of it back though. I might need the deepClone again and the 'JSON.parse' trick doesnt work with e.g. Dates. And the support for structured clone is... well it's complicated :D
https://developer.mozilla.org/en-US/docs/Web/API/structuredClone
Yeah, well... Maybe there's a polyfill for it somewhere? But I guess that would just do what deepClone from loadash is doing already?
Yes. Just have to doubleCheck (:P) if we really need a deep clone.
I think the lodash/deepClone is still the way to go. But than as single import and install (via
lodash.deepclone
). The single function packages are deprecated but as long as lodash v5 isn't out I think that's fine.