Live Edit doesn't update with external .js file

I'm using the latest version of phpStorm and noticed live edit doesn't update my chrome browser automatically when I make changes to an external .js file. It seems to update when the js code is in the .html file. In order to see my changes, I need to manually refresh my chrome browser. External .css files update like expected.

Is live edit supposed to update from external .js similar to .css files and if so what am I doing wrong?

Thanks

 

4 comments
Comment actions Permalink

I can certainly see the logic in this behavior, and there is a strong case to be made that it is objectively correct.  However, it does seem to seriously constrain the value of Live Edit.

VS Code, with the Live Server plugin, immediately executes any changed js.  That makes if more efficient for prototyping, etc.

I wonder if it might be a good idea to make this behavior configurable?

3
Comment actions Permalink

I agree with Reede Stockton. jsfiddle and plnkr also immediately execute js changes. the value of live edit is severely depleted without this functionality 

2
Comment actions Permalink

Changes in javascript embedded in HTML always cause page reloading, so the result of editing embedded javascript is instant; whereas changes in 'external' javascript are hotswapped - just as for HTML and CSS. But not each and every change in external javascript code results in immediate page update: new code is loaded to the browser instantly, but the results of the change will be visible only when you do something to trigger this new code. For example if you change the `onClick` handler and write new text in alert, you will see the new text after the click without reloading the page. Same for functions triggered by timer, for example. But if the JS code is executed only on page load (and not on certain event), you have to manually reload the page to see the results - live edit doesn't force new code execution

1
Comment actions Permalink

That makes sense. I wanted to make sure I wasn't missing out on something.

Thanks for the fast response!

0

Please sign in to leave a comment.