By Tom Locke
I have a Vue 3 app, built with vite, and a node backend.
I’m trying to deploy to App Platform, using a static site for the frontend assets, and a service for the backend.
When vite builds the frontend js and css assets, they get a unique hash as part of the filename. The build process also creates a manifest.json with theses hashes, which the backend can load in order to generate the <script> and <link> tags.
Because the components (static site, service) are isolated from each other, the only way I can think to load the manifest is to make an HTTP GET to the static site. Seems over complicated. Is there an easier way?
It is possible to turn off these hashes and have predictable file names, but then you lose the cache-busting benefits, right?
Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya,
Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.
Yes, you’re correct about the cache-busting benefits of hashed assets, turning them off would bypass this advantage. In a nutshell, it’s due to the way the DigitalOcean App Platform isolates components into their own containers for security and scalability purposes that each component does not have direct access to the files of other components.
However, there are a couple of potential workarounds:
Shared volume: In certain complex applications, it might be feasible to share data between components through a volume. However, as of now, the App Platform does not support shared volumes across app components.
Content Delivery Network (CDN): An alternative is to store the manifest file and your assets in a CDN and have both your frontend and backend fetch these files from there. This gives you consistent URLs to your assets, liberates you from relative paths, and offers you good cache control.
Even the CDN approach has its cons, the reason being that you must ensure that the CDN is updated whenever the manifest file changes, which would typically be with every new build.
Fetching the manifest.json with an HTTP GET within your service, as you suggested, though not the most elegant solution, happens to be the simplest and most effective one in this case.
Keep in mind that the above pieces of advice are subject to the unique constraints of your application’s architecture.
For more details on deploying with the App Platform, do visit this link: DigitalOcean docs
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.