sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

Add support for caching the build for 2nd load onwards

Open mohdashraf010897 opened this issue 3 years ago • 3 comments

Tell us how you think we can improve Sandpack

The current implementation of bundler doesn't cache the build which means, even on the second or subsequent loads the whole build process starts from scratch causing a huge performance overhead(think about a sandpack using tons of npm dependencies)

Packages affected

  • [x] sandpack-client
  • [x] sandpack-react

What is this feature?

Feature Request: Add support for caching the build for 2nd load onwards

This helps with our use-case of running a "heavy sandpack"! This should also help every user of sandpack have an instant preview 2nd load onwards (no matter their choice of template and build step)

mohdashraf010897 avatar Oct 18 '22 05:10 mohdashraf010897

cc @danilowoz @DeMoorJasper

mohdashraf010897 avatar Oct 18 '22 05:10 mohdashraf010897

Is there a workaround for caching bundles at point in times and using them for instant preview?

In our Sandpack use-case, the time taken to resolve (assuming npm modules of all deps are cached) is currently closer to 20s.

For more context: Original question thread on discord.

siddharthlatest avatar Nov 07 '22 16:11 siddharthlatest

@danilowoz Any updates on this issue or an alternative that you recommend for this use-case?

siddharthlatest avatar May 24 '23 11:05 siddharthlatest