Chrome开发者工具会缓存旧版本的JavaScript文件 [英] Chrome Developer Tools caches old version of JavaScript files

查看:176
本文介绍了Chrome开发者工具会缓存旧版本的JavaScript文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的间歇性问题,Chrome Developer工具挂在旧版本的JavaScript文件上。我将开发一些JS应用程序,只是找到的东西,然后突然我的JavaScript文件将从源选项卡上的JavaScript文件列表中消失。这是我第一个发现错误的线索。

I'm experiencing a strange intermittent issue with Chrome Developer tools hanging on to old versions of JavaScript files. I'll be developing some JS app, things humming along just find, and then all the sudden my JavaScript files will disappear from the list of JavaScript files on the "sources" tab. This is my first clue that something is wrong.

我最终发现Chrome Developer Tools显然是挂在旧版本的JavaScript文件上。 Chrome本身正在从服务器请求并执行最新版本,但您无法调试JavaScript文件。

What I eventually discovered is that Chrome Developer Tools is, apparently hanging on to an old version of the JavaScript file. Chrome itself is requesting and executing the latest version from the server, but you can't debug the JavaScript file.

我向自己证明这就是发生的事情从我的源列表中删除已丢失的特定JavaScript文件,并将其替换为一行 console.log 语句。

I "proved" to myself that this was what's happening by taking a particular JavaScript file that had disappeared from my sources list, and replacing it with a one line console.log statement.

然后我重新加载页面,并注意到console.log语句出现在JavaScript控制台中。我还在网络选项卡中注意到JavaScript文件已成功检索,并且通过网络传输的内容只包含一行 console.log 语句。

I then reloaded the page, and noted that the console.log statement appeared in the JavaScript console. I also noted in the Network tab that the JavaScript file was successfully retrieved, and that what came down over the wire contained just the one line console.log statement.

然而,JavaScript文件仍未出现在源列表中,如果我在控制台中单击文件名(它出现在控制台的右侧,旁边记录的语句),然后我跳转到sources选项卡,打开旧版本的JavaScript文件。

However, the JavaScript file still didn't appear in the sources list, and if I clicked on the filename in the console (where it appears on the righthand side of the console, next to the logged statement), then I jump to the sources tab, and an old version of the JavaScript file is opened.

这个JavaScript文件通过常规加载到页面上< script> 代码。它不是通过其他脚本动态加载,也不是通过eval加载。只是一个简单的,香草< script> 标记,指向网络服务器上的.js文件。

This JavaScript file is loaded onto the page via a regular <script> tag. It is not loaded dynamically, via another script, or via eval. Just a plain, vanilla <script> tag that points to the .js file on the webserver.

I尝试过:


  1. 确保在DevTools设置中选中禁用缓存(当DevTools打开时)。

  2. 手动清除Chrome中的缓存和Cookie。

  3. 重新启动Chrome

  4. 在单独的Chrome标签中手动加载JavaScript文件

  5. 停用我已安装的每个Chrome扩展程序/应用

  6. 以隐身模式运行该页面

  7. 取消选中启用JavaScript源地图和启用CSS源地图

  1. Ensuring that "Disable cache (while DevTools is open)" is checked in the DevTools settings.
  2. Manually clearing out my cache and cookies in Chrome.
  3. Restarting Chrome
  4. Manually loading the JavaScript file in a separate Chrome tab
  5. Disabling every Chrome extension/app that I have installed
  6. Running the page in incognito mode
  7. Uncheck both "Enable JavaScript source maps" and "Enable CSS source maps"

这些都没有改变行为。如果您不相信我,可以观看在此展示此视频的视频!

None of these changed the behavior. You can watch a video demonstrating this here, if you don't believe me!

我认为这是一个Chrome问题,因为我可以在没有这个问题的情况下使用Firefox ...但我真的很喜欢Chrome和Chrome的开发者工具:-)所以我想得到这个在Chrome中工作...

I do think it's a Chrome issue, as I can use Firefox without this issue... but I really like Chrome and Chrome's developer tools :-) So I'd like to get this working in Chrome...

更新我将此报告为Chrome错误这里。如果此错误对您有影响,或对您很重要,请将其投票和/或添加带有其他信息的评论。

Update I reported this as a Chrome bug here. If this bug is affecting you, or important to you, please vote it up and/or add comments with additional information.

推荐答案

谷歌似乎已经解决了这个问题。它已经停止了我。

Google appears to have fixed this issue. It's stopped occurring for me.

这篇关于Chrome开发者工具会缓存旧版本的JavaScript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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