Search code examples
google-chromecachingvisual-studio-2012typescriptgoogle-chrome-devtools

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 ?


Solution

  • 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>