Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Chrome doesn't update Typescript source files on change?

I'm working on a TypeScript (0.9.1) project using Visual Studio 2012 with the latest Web Essentials as the IDE, and i debug using Chrome Developer tools.

Recently, and most probably after Chrome update (cur. Version 29.0.1547.66 m), typeScript files don't get updated after i edit them, and on the other hand the corresponding compiled js files are updated, but it seems that somehow the functionality still depends on the non-updated version of the sources.

Solutions tried and failed:

  • Rebuild the full solution.
  • Hard refreshing (Shift + F5) the local host site on chrome
  • Deleting Source map files and generate them again.

After some trials it looks like even a request to download the ts source files yields the non-updated version (http://localhost:1198/xxx.ts e.g)

It seems that the problem gets partially fixed after full restart (windows 8 if it matters), the source files are updated in chrome, but once i change it again, the same problem appears.

Another solution was using incognito, as it seems that it's a caching problem.

My question:

Is caching typeScript files that way is caused by a problem in the configurations of the project (even it was working before), or this is a bug in the new version of Chrome ?

like image 486
Ali Essam Avatar asked Sep 06 '13 12:09

Ali Essam


People also ask

How do I refresh JavaScript in chrome?

Hold down Ctrl and click the Reload button. Or, Hold down Ctrl and press F5. just open the Chrome Dev Tools by pressing F12. Once the chrome dev tools are open, just right click on the refresh button and a menu will drop down.

Does Chrome understand TypeScript?

TypeScript cannot be run or understood in any browser. So, TypeScript is compiled to JavaScript (which browsers can understand).

How do I debug TypeScript in Chrome?

To debug TypeScript, we need to create an index. html and inside that we need to link our findbug. js file, this is because we will use the Chrome DevTools and we will be able to debug our TypeScript file. After that, we need to install live-server or use the live-server extension for VS Code.


3 Answers

To I'm experiencing same problem. I solved this problem with chreome debug tools disable cache checked.

My second problem, i wrote a lot of class into a same file. i splice every class to seperate file.

enter image description here

like image 163
Abdullah SARGIN Avatar answered Sep 24 '22 05:09

Abdullah SARGIN


I solved this by removing the cached files manually. This can be done through Chrome's settings:

  1. Click on Customize and control Google Chrome - the burger menu icon in the top right corner of the browser window.
  2. Select Settings near the bottom of the menu.
  3. Scroll down and click on the Show advanced settings... link.
  4. Click on the Clear browing data... button.
  5. Check Cached images and files. The other checkboxes can be left unchecked.
  6. Click on the Clear browing data button.

The 'Disable cache' checkbox in the network tab didn't work for me, nor did a Ctrl+F5.

like image 24
Jan Aagaard Avatar answered Sep 22 '22 05:09

Jan Aagaard


If you are serving from IIS, We have manually disabled cache in our web.config file :

<system.webServer>

    <httpProtocol>

      <!--TODO: Remove this block for production (//TODO: Remove this block for production) -->
      <customHeaders>
        <!--DISABLE CACHE-->
        <add name="Cache-Control" value="no-cache, no-store, must-revalidate" />
        <add name="Pragma" value="no-cache" />
        <add name="Expires" value="0" />
      </customHeaders>

    </httpProtocol>
</system.webServer>     
like image 40
basarat Avatar answered Sep 24 '22 05:09

basarat