Repack and caching
Hello im trying to implement cache, to support offline mode and also quicker loading times, im using zephyr cloud, can i somehow use this with zephyr (not sure if this will work coz zephyr will replace url, or not?)? https://re-pack.dev/docs/features/code-splitting#caching-and-versioning
Or can i somehow enable automatic caching when new deploy version is available? like param in import {withZephyr} from 'zephyr-repack-plugin';
Thank you!
Re.Pack
A modern build tool for React Native
8 Replies
@AliX Hey Hey
About the caching thing, you should be able to cache and benefit from cache when you use either tag URLs or better Environment URLs. These will never change and will update based on tag conditions or manually inside of the Zephyr Dashboard.
About the offline mode, we do not have any concrete example about this unfortunatly right now, but it should be doable, I can ask and get back to you.
thank you for the response! can i somehow get that urls firstly? to compare with cache
What do you mean by firstly ?
if i understand correctly you want from me to use instead of using "withZephyr" plugin, insert manually url with env for using cache https://re-pack.dev/docs/features/code-splitting#caching-and-versioning so my question is how can i get that actual urls
Re.Pack
A modern build tool for React Native
No, no need for that
What I meant is to create an tag, and use that tag
because that tag will never change its URL
or use an environment URL if you want to use a specific domain for it
https://docs.zephyr-cloud.io/how-to/versioning-tags
yeah got it but still not solving my question how can i save my bundle locally
That's the part that I mentioned early that I believe we do not have any examples at the moment. I asked this question into the chat with the other folks. I'll let you know if I get any feedback on it 😄
hey @AliX
about offline mode, you could potentially build a plugin which downloads remotes at build time but also caches them at runtime so you always get the freshest one.
I did something similar a while ago for an Electron app.
Take a look here
https://github.com/ryok90/nextjs-mf-examples/blob/main/latest-complete-example/apps/host/mf-config/plugins/remote-loader.js