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

Analyse and reduce the bundle size #137

Open
santhoshtr opened this issue Aug 3, 2021 · 5 comments
Open

Analyse and reduce the bundle size #137

santhoshtr opened this issue Aug 3, 2021 · 5 comments

Comments

@santhoshtr
Copy link
Member

Currently the https://wikimedia.github.io/wikipedia-preview/demo/script/wikipedia-preview.production.js is about 142KB. Out of 142KB, about 136KB is dompurify library.

I see that DOMPurify is used for sanitizing the content from wikipedia. May be we need to check the trust model for the content too. If we can avoid bundling dompurify, then wikipedia-preview is just 5.4KB uncompressed.

@hueitan
Copy link
Member

hueitan commented Aug 3, 2021

This is how it looks like npm run wba,
and we can also lower the bundle size if we take care of the i18n files in this task

image

@santhoshtr
Copy link
Member Author

To clarify, I was talking about https://wikimedia.github.io/wikipedia-preview/demo/script/wikipedia-preview.production.js file. Its big share is dompurify. For example in the web page, https://diff.wikimedia.org/2021/07/29/new-wikipedia-preview-feature-provides-context-from-wikipedia-across-the-web/ this is one of the biggest javascript assets.

@stephanebisson
Copy link
Collaborator

@santhoshtr I'm curious about how you got those numbers (136k / 124k) from that production file. The only way I know how to measure those things is with Webpack bundle analyzer (see Huei's screenshot).

That said, I would also like to remove DOMPurify.

@hueitan
Copy link
Member

hueitan commented Nov 27, 2024

This is the new bundle size visualization after this #177, we have plan to remove the purify.js and have the i18n as the separate #222

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants