1

Closed

VS compiled typescript code can't run in Chrome/FF?

description

I have a sample project that works great in IE but not at all in Chrome or FF. It looks like the files are being encoded improperly and IE is figuring it out but Chrome and FF aren't...

For example
Here are the first few likes of a compiled JS file
/// <reference path="../Framework/Core.ts" />
var MVVM;
(function (MVVM) {
var Application = (function () {
    function Application() {
        this.core = undefined;
        this.templatePath = "Atlatl/Templates/";
        this.viewPath = "Atlatl/Views/";
        this.dependentScriptsPath = "Scripts/";
        this.viewModelsPath = "Atlatl/App/ViewModels/";
        this.frameworkPath = "Atlatl/Framework/";
        this.pages = {
        };
and here is what Chrome "thinks" its receiving from IIS :
 爼晥牥湥散瀠瑡㵨⸢⼮牆浡睥牯⽫潃敲琮≳⼠ാ瘊牡䴠噖㭍਍昨湵瑣潩䴨噖⥍笠਍††慶⁲灁汰捩瑡潩‽昨湵瑣潩⤨笠

I have tried all the following compilation methods with various failures, all along the same lines

1) Just using the Typescript compiler in VS
2) Using Web Essentials
 A) With and without UTF-8 BOM flags set to true
 B) With and without recompiling on build
I can provide a sample project, or if you go thru this tutorial you will see what I am talking about https://github.com/CatapultSystems/atlatl/wiki/Visual-studio-hello-world

I am totally stumped as to what could be causing this...

Thanks
Josh
Closed Apr 4, 2013 at 8:53 PM by danquirk
There certainly looks to be something awry here. I'm having trouble getting the linked tutorial working properly though. Could you attach your own project where this is happening and re-open this bug so we can take a look?

comments

jhandel wrote Apr 3, 2013 at 5:21 PM

I've also tried the VS build in webserver with the same results.

jhandel wrote Apr 3, 2013 at 5:28 PM

last comment for the moment.. Opening the file in notepad, and re-saving it as UTF-8 fixes the issue... So its not a server issue, its definitely a file issue.

jhandel wrote Apr 3, 2013 at 9:59 PM

I have a work around.. I can force VS to save the file as a proper UTF file by placing
var dummyChars = "Ù";
at the top of each of my TS files.. this compiles a special character into the JS, and forces VS (or TS or whoever) to properly save the file).