Open santhoshtr opened 3 years ago
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
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.
@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.
This is the new bundle size visualization after this https://github.com/wikimedia/wikipedia-preview/pull/177, we have plan to remove the purify.js
and have the i18n
as the separate https://github.com/wikimedia/wikipedia-preview/pull/222
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.