Answer the question
In order to leave comments, you need to log in
How to cache correctly in webpack?
In my view: webpack simply creates a hash in the file names, and my task is to cache them in any way.
My caching is done by nginx.
Problem:
I uploaded statics to the server, he gave it to the client, after updating the statics on the server, it is updated on the client. But, when I go to another route of the site (with a page refresh), the update did not happen, again, when the page is updated, the static is also updated, but if I go to some other route again ...
It turns out that the static was saved on each route in a new way ?
nginx:
// переменная
map $sent_http_content_type $expires {
~image/ 30d;
text/html off;
default 7d;
}
// при отдаче статики:
location / {
try_files $uri $uri/ /index.html;
expires $expires;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question