[DRAFT] Code-split bundled WMR for performance #62
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.
Currently we generate a single 1.5mb
wmr.cjs
file. This is really nice for distribution, but it does mean that anyone runningwmr
pays the full cost of parsing and compiling all that JS, even though roughly half of it is used depending on whether you're runningwmr
orwmr build
.I've tested out a few configurations, and this is what I came up with: basically it generates a couple more files (3 or 4) so that "prod bundling" and "http2" are handled in 1.1mb and 160kb commonjs modules that are conditionally loaded the first time they are used. In the case of running
wmr
(watch mode), neither are loaded.I'm on the fence about whether this is the right thing to do. From a performance standpoint it will probably be a faster startup, but it complicates delivery (in a way that maybe only I care about? lol) 📦