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

Live Preview: Reduce file size #86626

Closed
taipeicoder opened this issue Jan 19, 2024 · 4 comments
Closed

Live Preview: Reduce file size #86626

taipeicoder opened this issue Jan 19, 2024 · 4 comments

Comments

@taipeicoder
Copy link
Contributor

taipeicoder commented Jan 19, 2024

Description

See p1705629726572469-slack-CRWCHQGUB. Currently, the file size for wpcom-live-preview-notice.js exceeds 3mb pre-processed. While lazy loaded, it would be good to look into how could we reduce the file size by removing some of the package imports.

@jsnajdr
Copy link
Member

jsnajdr commented Jan 22, 2024

This is strange, the plugin imports a few string constants from calypso-products, and yet it bundles the entire package, plus @tanstack/query. It's like there wasn't sideEffects: false in calypso-products/package.json, but it's there.

@jsnajdr
Copy link
Member

jsnajdr commented Jan 22, 2024

It's caused by #85013 (by @okmttdhr) which includes the ThemeUpgradeModal component from Calypso, dragging a sizable piece of Calypso into the block editor: the React Query client, products library, UI components, ...

@taipeicoder
Copy link
Contributor Author

Hey @jsnajdr thanks for looking this!
For more context, we currently lazy load this file, which after processing should be around 290kb.

Lazy loading introduced another issue on its own, which was that the file did not contain any cache buster. We addressed it in this PR #86691.

If there are still any concerns about lazy loading this file, we can look into making the ThemeUpgradeModal leaner. cc: @Automattic/lego

@jsnajdr
Copy link
Member

jsnajdr commented Jan 22, 2024

Thanks for the update! Downsizing ThemeUpgradeModal looks like an uneasy task. Now when we know where the bundle size is coming from, and when we manage it by lazy loading, there is probably nothing straightforward we can do to improve this.

@taipeicoder taipeicoder closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2024
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

No branches or pull requests

2 participants