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

Upgrade lit + shoelace to reduce build size #938

Merged
merged 7 commits into from
Jul 20, 2023

Conversation

SuaYoo
Copy link
Member

@SuaYoo SuaYoo commented Jul 3, 2023

Reduces the number of lit versions bundled in the app. Related to #378 but does not fully resolve the issue, since there's still two versions. Needs more investigation as to which package has lit bundled in the dist (se note)

Comparison

Versions bundled

Before:

window.litElementVersions: [ "3.1.1", "3.2.2", "3.2.0" ]
window.reactiveElementVersions: [ "1.1.1", "1.6.1", "1.6.1" ]
window.litHtmlVersions: [ "2.1.1", "2.6.1", "2.6.1" ]

After:

window.litElementVersions['3.1.1', '3.3.2']
window.reactiveElementVersions['1.1.1', '1.6.1']
window.litHtmlVersions['2.1.1', '2.7.4']

Build size

Before:
Screen Shot 2023-07-19 at 2 15 54 PM

After:
Screen Shot 2023-07-19 at 2 15 49 PM

Note

Although running yarn install only installs a single version of lit, there are still two versions in the final build, which indicates lit is bundled in one of the packages. Verified that single version of lit is installed with yarn why lit:

=> Found "[email protected]"
info Has been hoisted to "lit"
info Reasons this module exists
   - Specified in "dependencies"
   - Hoisted from "@lit#localize#lit"
   - Hoisted from "@lit#localize-tools#lit"
   - Hoisted from "@shoelace-style#shoelace#lit"
   - Hoisted from "@open-wc#testing#@open-wc#testing-helpers#lit"
info Disk size without dependencies: "1.3MB"
info Disk size with unique dependencies: "5.86MB"
info Disk size with transitive dependencies: "5.91MB"
info Number of shared dependencies: 3
=> Found "[email protected]"
info Reasons this module exists
   - "lit" depends on it
   - Hoisted from "lit#lit-element"
info Disk size without dependencies: "660KB"
info Disk size with unique dependencies: "4.58MB"
info Disk size with transitive dependencies: "4.61MB"
info Number of shared dependencies: 3
=> Found "[email protected]"
info Reasons this module exists
   - "lit" depends on it
   - Hoisted from "lit#lit-html"
   - Hoisted from "@open-wc#testing#@open-wc#testing-helpers#lit-html"
   - Hoisted from "lit#lit-element#lit-html"
info Disk size without dependencies: "2.66MB"
info Disk size with unique dependencies: "2.68MB"
info Disk size with transitive dependencies: "2.68MB"
info Number of shared dependencies: 1

I think it's worth merging this PR in while investigating for the reduced overall bundle size and upgraded versions.

@SuaYoo SuaYoo force-pushed the frontend-upgrade-lit-shoelace branch from ea0af91 to e947a1b Compare July 19, 2023 21:17
@SuaYoo SuaYoo changed the title Upgrade lit + shoelace Upgrade lit + shoelace to reduce build size Jul 19, 2023
@SuaYoo SuaYoo requested a review from ikreymer July 19, 2023 21:31
@SuaYoo SuaYoo marked this pull request as ready for review July 19, 2023 21:31
@ikreymer ikreymer merged commit 8591311 into main Jul 20, 2023
@ikreymer ikreymer deleted the frontend-upgrade-lit-shoelace branch July 20, 2023 09:50
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.

2 participants