简体   繁体   English

如何避免缓存 create-react-app

[英]How to avoid caching for create-react-app

I have created an app using create-react-app but it always loads old index.html from client我使用 create-react-app 创建了一个应用程序,但它总是从客户端加载旧的 index.html

tried with meta tags to avoid cache in index.html but does not load new html always尝试使用元标记来避免 index.html 中的缓存,但并不总是加载新的 html

index.html索引.html

One way can be using the meta tags.一种方法是使用元标记。 <meta http-equiv='cache-control' content='no-cache'> <meta http-equiv='expires' content='0'> <meta http-equiv='pragma' content='no-cache'>

A very Rare condition.非常罕见的情况。 sometimes it may be because of your browser cache.有时可能是因为您的浏览器缓存。 there is an option in your Dom inspector which helps to disable caching. Dom 检查器中有一个选项可以帮助禁用缓存。 press F12 to toggle dom inspector.按 F12 切换 dom 检查器。 select the network tab Try the tick on.选择网络选项卡尝试勾选。

Also make sure that you are editing and previewing the same index.html file.还要确保您正在编辑和预览同一个 index.html 文件。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM