Closed IceCreamYou closed 6 years ago
I ended up implementing something along these lines today and it brought typical bundle times down 20-30X.
I am still interested in whether getCache()
and setCache()
are considered stable public APIs, but I will close this issue since my motivating problem is solved for the moment.
I have a custom Grunt task,
grunt bundle
, which uses SystemJS Builder to create multiple bundles. I would like to reduce the amount of time it takes to run that task. To that end, I am thinking about how to avoid regenerating bundles when the underlying modules haven't changed, since often only one bundle will need to be rebuilt.One way to do this could look something like:
bundles
property from the SystemJS config and the map of bundles to entry point expressions from wherever we saved thatThis seems possible to do by extending my custom Grunt task, though it's not trivial. Does this seem like a sensible thing to do, or do any risks jump out?
One potential addition could be to use the builder's
getCache()
andsetCache()
methods to write the builder cache to a file after each task run and load it up before the next task run. However,getCache()
andsetCache()
are not documented inapi.md
. Are these functions, including the structure of the cache objects, considered stable public APIs? Also, the serialized output ofgetCache
will be quite large. Does it seem likely that the cost of reading and parsing the persisted cache will outweigh the benefits of keeping it around, considering that much of it will normally need to be invalidated anyway?Finally, am I missing any better approaches?
Thanks in advance for thoughts/help here.