使用require.js缓存时调试 [英] Debugging when using require.js cache

查看:438
本文介绍了使用require.js缓存时调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用require.js我注意到,往往依赖由浏览器缓存,并没有得到更新,即使我强制页面重新加载完全(命令+ SHIFT + R)。

Using require.js I noticed that often the dependencies are cached by the browser and don't get updated even if I force the page to completely reload (command+shift+R).

为了始终更新的文件,我做了require.js要求添加文件?戳在URL后。这种方法唯一的问题是,断点不会停留在镀铬或萤火重装后,使调试痛苦的。

In order to have always the updated file, I made require.js ask for the files adding '?datestamp' after the url. The only problem with this approach is that the breakpoints don't remain in chrome or firebug after reloading, making the debug painful.

你有什么建议吗?

推荐答案

其实有一些事情可以做:

Actually there are some things you can do:

要么你完全禁用您的浏览器缓存,以测试它。例如,在一个简单的方法Chrome是打开的隐身窗口的(Ctrl + Shift + N)类似的隐私浏览的在Firefox模式。但是你更理想的解决方案应该在这里列出:<一href=\"http://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development\">disabling铬缓存网站开发

Either you disable your browser caching completely to test it. An easy way in e.g. Chrome is to open a Incognito Window (CTRL + SHIFT + N) similar to the Private Browsing mode in Firefox. However the more ideal solution for you should be listed here: disabling chrome cache for website development

或者您指示您的Web服务器发送没有缓存头为JavaScript或一些JavaScript文件。一种可能性是使用指定mod_expires 与Apache。

Or you instruct your webserver to send no cache headers for javascript or some javascript files. One possibility is to use mod_expires with apache.

这篇关于使用require.js缓存时调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆