Bundle dependencies #67
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.
This packages up the contents of
content/tutorial/common
into a zip file and generates a smallboot.cjs
file that unzips it inside the webcontainer.There's a tiny bit more to it than that — we exclude certain unused files from the zip file, and rename
esbuild-wasm
toesbuild
— but it all works pretty nicely. In this video, the top browser is the currentmain
, the bottom one is this PR. The first load is with a disabled cache, the second is with a populated cache:startup-comparison.mov
It's possible that
turbo
with apackage-lock.json
would be comparable, but it would be tricky to maintain lockfiles for all the apps that have dependencies from npm.One thing this PR doesn't consider is whether life will get complicated in future if we want to allow the user to install dependencies on-demand, since in that case
turbo
would need to construct a lockfile anyway, meaning that installation would be slower than if we started with a lockfile. But we can cross that bridge when we come to it.