Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webstorm not refreshing modified JavaScript files

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?

like image 318
pancake Avatar asked Mar 22 '13 22:03

pancake


People also ask

Is there live server in WebStorm?

There's a plugin in Visual Studio called Live Server. When you edit and save changes to an html/css file, you don't have to refresh the page if it's open in your browser, it refreshes automatically. Webstorm has similar functionality called Live Edit, but it works in debug mode only.

How do I run Javascript in WebStorm?

To run a script, open it in the editor or select it in the Project tool window, and then select Run <script file name> from the context menu. WebStorm creates a temporary run/debug configuration of the type Node. js. To run a test, click the gutter icon next to it or press Ctrl+Shift+F10 .

How do I use live edit on WebStorm?

In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Build, Execution, Deployment | Debugger | Live Edit. On the Live Edit page that opens, select the Update application in Chrome on changes in checkbox. By default, WebStorm shows on-the-fly preview only for HTML and CSS code.

How do you add a picture on WebStorm?

Select the image file in the Project tool window, and select Jump to external editor or press Ctrl+Alt+F4 . WebStorm opens the image in the editor that is used in your OS by default. You can configure another image editor in which the IDE will open files.


1 Answers

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

  • Install Web Developer toolbar, Disable -> "Disable Entire Cache"

  • or; see this accepted answer

like image 99
pancake Avatar answered Sep 29 '22 06:09

pancake