When releasing a project, you will often encounter the problem of needing to clean up the cache. Here is the actual method to disable the cache for the project. 1. Modify the meta configuration of the index.html file in the public folder <meta http-equiv="pragram" content="no-cache" /> <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="expires" content="0" /> 2.vue cli build configuration (for versions below vue3) Add configuration in vue.config.js const Timestamp = new Date().getTime() module.exports = { configureWebpack: { output: { // Output the name of the file after reconstruction, packaging and compilation [module name. version number (optional). timestamp] filename: `[name].${Timestamp}.js`, chunkFilename: `[name].${Timestamp}.js` }, }, css: { extract: { // Add timestamp to the name of the CSS file after packaging filename: `css/[name].${Timestamp}.css`, chunkFilename: `css/[name].${Timestamp}.css` } }, } 3. Nginx configuration Disable nginx cache and let the browser request files from the server each time instead of reading cached files in the browser. After the program is debugged and launched, you can enable nginx cache to save server bandwidth, reduce some requests, and reduce server pressure. Configure the HTML file in the nginx.conf file to add a header by default and not cache the configuration The following actual project nginx cache configuration location ~ .*\.(?:htm|html)$ { add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate"; } Nginx static resource cache settings https://www.jb51.net/article/222620.htm This is the end of this article about the case of disabling browser cache configuration in vue project. For more relevant content about disabling browser cache configuration in vue project, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Tutorial on installing Nvidia graphics card driver in Ubuntu 18.04 (with pictures and text)
>>: Ubuntu 20.04 CUDA & cuDNN Installation Method (Graphical Tutorial)
Zabbix server environment platform ZABBIX version...
Background-image is probably one of those CSS pro...
1. First, download the latest version of MySQL fr...
When installing nginx, mysql, tomcat and other se...
Delete a file by its inode number First use ls -i...
Folding display multi-line text component Fold an...
Table of contents 1. Build the operating environm...
Table of contents 1. Open WeChat Pay 1.1 Affiliat...
When the amount of data in MySQL is large, limit ...
Table of contents 1. Array deduplication 2. Dedup...
This article shares the specific code of JavaScri...
1. haslayout and bfc are IE-specific and standard ...
Table of contents 1. How to find duplicate rows 2...
As a software developer, you must have a complete...
On the server, in order to quickly log in to the ...