Dynamically load music extension manifest #1105
Merged
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.
Proposed Changes
Dynamically load the 1.6MB of music extension sample files dynamically.
Reason for Changes
Split the music extension samples to be loaded separate from the main scripts to need less to be downloaded and for faster first execution of those scripts so Scratch starts earlier.
This change uses webpack's chunking to dynamically load the music extension files. An improvement would be to fetch the files as data through fetch/xhr base64 encoded json content or as a sound sprite.
Dynamically loaded separate from the main scripts, music samples could be preloaded with a script tag, in this format, or with an audio or link tag in the html body if it was encoded in a json file or sound sprite. This would load the file near the same time of the main scripts without blocking their execution.