Repository navigation
Conversation
With ES modules alone, the lazy require() of mathml-to-latex in markdown.ts made the full bundle 16 KB larger, so it's a static import now. defuddle/node loads mathml-to-latex on import instead of on first use. Core bundle: -4.6 KB gzipped. Full bundle: -5.0 KB.
ES2020 keeps optional chaining, nullish coalescing, classes, async functions and spread as written instead of transpiling them. The bundles then need Chrome 80, Firefox 74 or Safari 13.1 or newer. Core bundle: -5.3 KB gzipped. Full bundle: -5.7 KB.
This branch has not been deployed
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.
Stacked on #520.
The core bundle goes from 98.2 to 88.4 KB gzipped and the full bundle from 216.0 to 205.3 KB, with identical output.
Both changes are in how
webpack.config.jscompiles TypeScript:require('mathml-to-latex')insrc/markdown.tsmade the full bundle 16 KB larger, so it's a static import now.defuddle/nodeand the Worker loadmathml-to-latexon import instead of on first use.??, classes, async functions and spread stay as written: −5.3 KB core, −5.7 KB full. The bundles then need Chrome 80, Firefox 74, Safari 13.1 or Node 14. The Web Clipper already requires newer (Firefox 113 and Manifest V3).The budgets go down to 90 and 207 KB, so later growth shows up.
Output is byte-identical to #520 for all 250 fixtures, at each fixture's own URL and at
https://example.com/page, with no options,separateMarkdownandmarkdown, under linkedom and JSDOM (1,500 runs each).tsc --noEmit,lint:unused,lint:innerhtml,npm run sizeand both Vitest suites pass. Those run the TypeScript source, so I also ran every fixture through the built UMD bundles (the full bundle with the three option sets, the core bundle with none, 2,000 runs per DOM), and the output matches #520's bundles. That check gives the bundles JSDOM'swindow,documentandDOMParser; I haven't run them in a real browser or happy-dom.