Webstorm不刷新修改后的JavaScript文件 [英] Webstorm not refreshing modified JavaScript files

查看:836
本文介绍了Webstorm不刷新修改后的JavaScript文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的HTML页面引用了一些JavaScript文件,如:

 < script type =text / javascriptsrc = MyClass.js>< /脚本> 

我正在使用Windows中的SimpleHTTPServer与Chrome一起调试WebStorm。我可以在JavaScript中设置断点,WebStorm可以按预期停止。

然而,有时当我更改JavaScript并重新启动调试器时,它会运行旧代码,而不是更新的代码。如果我放置一个断点,它停在的那一行与我放置断点的位置不同步。



如何强制刷新?

解决方案问题是Chrome(和Firefox)缓存JavaScript - 也许这超出了WebStorm的控制范围。它的解决方法如下:


Chrome


  • F12打开开发人员面板,然后右键单击工具栏中的刷新 - >清空缓存并重新加载硬盘


  • 或; F12打开开发者面板,右下角的设置图标,勾选禁用缓存。

  • 安装Web Developer工具栏,禁用 - >禁用整个缓存 $ b $ b
  • 或;请参阅此接受的答案



My HTML page references a few JavaScript files like:

<script type="text/javascript" src="MyClass.js"></script>

I am debugging with WebStorm using a Python SimpleHTTPServer in Windows with Chrome. I can set breakpoints in my JavaScript and WebStorm stops at them as expected.

However, sometimes when I make changes to my JavaScript and relaunch the debugger, it runs the old code, not the updated code. If I place a breakpoint, the line it stops at is out-of-sync with where I've placed the breakpoint.

How can I force a refresh?

解决方案

The problem was Chrome (and Firefox) caching JavaScript - maybe this is beyond WebStorm's control. It is solved as follows:

Chrome

  • F12 to open the developer panel, then right-click Refresh in toolbar -> "Empty cache and hard reload"

  • or; F12 to open the developer panel, Settings icon bottom right, check "Disable cache"

Firefox

这篇关于Webstorm不刷新修改后的JavaScript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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