Nuxt.js: Is there a way to control the nuxt cache when deploying?

Created on 15 Jan 2019  Â·  12Comments  Â·  Source: nuxt/nuxt.js

Hi.
When using Nuxt, I ask questions.

When I distribute the site that I have built, it is not working properly due to a cache problem.
There are two cases below. Is there any way to solve them?

  1. If built, the file names of js and css will be renamed to hash values, but it was not reflected by viewing old cache in browser.

  2. Create applications using vue-native webview The webview in the application looked up the old cache. To apply the changed js, css, how do I remove the cache from the past?

I would appreciate it if you could show me how to clearly manage the cache.

This question is available on Nuxt community (#c8476)

All 12 comments

This issue as been imported as question since it does not respect nuxt.js issue template. Only bug reports and feature requests stays open to reduce maintainers workload.
If your issue is not a question, please mention the repo admin or moderator to change its type and it will be re-opened automatically.
Your question is available at https://cmty.app/nuxt/nuxt.js/issues/c8476.

I'm having the exact same issue..

Did you find a way?

same here

Same here. Can this be requalified as an issue please?

+1 UP

Any of you got a setup where the problem can be reproduced? It's pretty random here :/
If so, it might be more effective to raise a correct issue

i'm having the same issue , i need to wait between 1h and 1 day to have the website fully working after a build

Same here

+1 UP

This issue is closed. You won't find an answer here. Instead, please open a new one with the correct template.

Thanks for the help!! You are amazing

For anyone looking for a solution to this (I found this closed thread with no solution)...here's what I faced and the approach that worked and was easy to implement.

Issue: The HTML would not show changed from new deployments until the browser was refreshed.

Solution:

  1. Create a new file in the static folder called version.json - in mine I have one JSON object {version: 'x.x.x' }
  2. Commit this file and remember to change the version number with each release.
  3. In my default layout I have a beforeEach route that essentially makes an axios call to this file and gets the version number, then a simple if statement checks if 'version' is present in local storage, if it is and they don't match it executes window reload, executes the reload if it doesn't find version in local storage.

It turned out to be simple to implement and just works. I followed a medium post about using Pusher to do something similar albeit a lot more complex.

Hope this helps someone else facing these issues ✋

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nassimbenkirane picture nassimbenkirane  Â·  3Comments

VincentLoy picture VincentLoy  Â·  3Comments

mattdharmon picture mattdharmon  Â·  3Comments

o-alexandrov picture o-alexandrov  Â·  3Comments

vadimsg picture vadimsg  Â·  3Comments