Various tweaks to reduce main bundle size#1929
Merged
tdonohue merged 5 commits intoDSpace:mainfrom Oct 27, 2022
Merged
Conversation
This allows us to get rid of the json5 dependency in the main bundle and reduces the size of the i18n files we serve a bit
d03fc00 to
bde8419
Compare
…-bundle-size-part1
tdonohue
approved these changes
Oct 27, 2022
Member
tdonohue
left a comment
There was a problem hiding this comment.
👍 Thanks @ybnd !
I tested this in production mode (yarn serve:ssr) and everything is working well for me. I tried an item with Markdown & MathJax and that's still working. I verified the new JSON "compilation" of the i18n scripts is working properly and tested different languages & also tested SSR (by turning off all JS in my browser).
Finally, I verified that, in total, this PR shrinks the main.js by about 100KB gzipped! Great improvements!
Member
|
Merging this immediately as the changes are small, but very important. That way I can also update my |
4science-it
pushed a commit
to 4Science/dspace-angular
that referenced
this pull request
Jul 29, 2024
…pace#1929) Task/dspace cris 2023 02 x/DSC-1650 davide Approved-by: Francesco Molinaro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #1921
Description
This PR includes a few ways to reduce the size of the
main.jsbundledsMarkdownfor Markdown support lazy-loaded in the same way as the MathJax plugin(this saves about 80kb)
lodashso it can be properly optimized by tree-shaking(this saves about 16kB)
json5dependency from runtime code; convert i18n files to plain JSON in Webpack instead(this saves about 9kB and reduces the size of served i18n files slightly)
Instructions for Reviewers
dsMarkdownpipe still works by checking out some Items with Markdown indc.abstractChecklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
yarn run lintpackage.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.