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

Dynamic loading optimizations #1925

Merged
merged 2 commits into from
Feb 24, 2025
Merged

Conversation

Soxasora
Copy link
Member

@Soxasora Soxasora commented Feb 24, 2025

Description

Addresses #1832
Dynamically loads React QR Scanner, React Datepicker with a loading placeholder.
It uses Next.js handling of dynamic loading instead of a state-based solution like we saw with syntax highlighting and MathJax

Screenshots

QR Scanner + loading:

React Datepicker + loading:

datepicker.mov

Also React Syntax Highlighter + loading:

rsh.loading.mov

Additional Context

MathJax is not being considered for a loading placeholder for the fact that it's a plugin and not a component

Checklist

Are your changes backwards compatible? Please answer below:
Yes

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
7, modules gets lazy loaded correctly, code blocks have a slight padding shift

For frontend changes: Tested on mobile, light and dark mode? Please answer below:
n/a

Did you introduce any new environment variables? If so, call them out explicitly here:
No

Bundle Analyzing

Before #1909 and #1910

After

After this PR

7.31 MB to 6.53 MB _app stat size
3.12 to 2.77 _app parsed size

Throughout these PRs we can observe a total reduction from 1.71 MB to 990 kB, accumulating a 43% total reduction of the bundle that gets shipped to stackers.
^The latest changes have a 114 kB reduction

@Soxasora Soxasora marked this pull request as ready for review February 24, 2025 20:13
@huumn huumn merged commit 31532ff into stackernews:master Feb 24, 2025
6 checks passed
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