Visual Studio为不同的PC转换了不同的TypeScript输出

时间:2016-06-08 10:02:47

标签: javascript visual-studio typescript visual-studio-2015

我们遇到的问题是ts文件没有在所有不同的两台计算机上提供相同的js文件。

两台计算机都安装了Win10和VS2015 Enterprise的半全新安装(可能安装了medio)。

我们在Visual Studio中打开相同的ts文件并保存它而不对文件进行任何更改,但我的输出与我的同事输出不同。

我们检查了Typescript的procect设置,它们是相同的。还有什么可以解决这个问题?我们是打字稿的新手,google或stackovwerflow都没有能够给我们答案。

ts文件如下所示:

    export class App {
    public router: any;
    configureRouter(config, router) {
        config.title = 'Start';
        config.map([
            { route: 'start/:SBTSystemId', name: 'start', moduleId: './components/Start', title: 'Start', nav: false },
            { route: 'symptom/:SBTSystemId', name: 'symptom', moduleId: './components/symptom', title: 'Symptom', nav: false },
            { route: ['diagnostic/:SBTSystemId/:StepId/:PrevStepId', 'diagnostic/:SBTSystemId/:StepId'], name: 'diagnostic', moduleId: './components/diagnostic', title: 'Diagnostic', nav: false },
            { route: 'conclusion/:SBTSystemId/:ConclusionId/:PrevStepId', name: 'conclusion', moduleId: './components/conclusion', title: 'Conclusion', nav: false }
        ]);

        this.router = router;

    }
}
export function configure(aurelia) {
    aurelia.use
        .standardConfiguration()
        .developmentLogging()
        .globalResources(['assets/custom-elements/TopNavigationCustomElement', 'assets/custom-elements/BottomNavigationCustomElement', 'assets/custom-elements/SbtLinkCustomElement']);
    aurelia.start().then(() => aurelia.setRoot('app'));
}

我的输出是:

    System.register([], function(exports_1, context_1) {
    "use strict";
    var __moduleName = context_1 && context_1.id;
    var App;
    function configure(aurelia) {
        "use strict";
        aurelia.use
            .standardConfiguration()
            .developmentLogging()
            .globalResources([
            "assets/custom-elements/TopNavigationCustomElement",
            "assets/custom-elements/BottomNavigationCustomElement",
            "assets/custom-elements/SbtLinkCustomElement"]);
        aurelia.start().then(function () { return aurelia.setRoot("app"); });
    }
    exports_1("configure", configure);
    return {
        setters:[],
        execute: function() {
            App = (function () {
                function App() {
                }
                App.prototype.configureRouter = function (config, router) {
                    config.title = "Start";
                    config.map([
                        {
                            route: "start/:SBTSystemId", name: "start",
                            moduleId: "./components/Start", title: "Start", nav: false
                        },
                        {
                            route: "symptom/:SBTSystemId", name: "symptom",
                            moduleId: "./components/symptom", title: "Symptom", nav: false
                        },
                        {
                            route: ["diagnostic/:SBTSystemId/:StepId/:PrevStepId", "diagnostic/:SBTSystemId/:StepId"], name: "diagnostic",
                            moduleId: "./components/diagnostic", title: "Diagnostic", nav: false
                        },
                        {
                            route: "conclusion/:SBTSystemId/:ConclusionId/:PrevStepId", name: "conclusion",
                            moduleId: "./components/conclusion", title: "Conclusion", nav: false
                        }
                    ]);
                    this.router = router;
                };
                return App;
            }());
            exports_1("App", App);
        }
    }
});
//# sourceMappingURL=app.js.map

他的输出是:

    "use strict";
var App = (function () {
    function App() {
    }
    App.prototype.configureRouter = function (config, router) {
        config.title = 'Start';
        config.map([
            { route: 'start/:SBTSystemId', name: 'start', moduleId: './components/Start', title: 'Start', nav: false },
            { route: 'symptom/:SBTSystemId', name: 'symptom', moduleId: './components/symptom', title: 'Symptom', nav: false },
            { route: ['diagnostic/:SBTSystemId/:StepId/:PrevStepId', 'diagnostic/:SBTSystemId/:StepId'], name: 'diagnostic', moduleId: './components/diagnostic', title: 'Diagnostic', nav: false },
            { route: 'conclusion/:SBTSystemId/:ConclusionId/:PrevStepId', name: 'conclusion', moduleId: './components/conclusion', title: 'Conclusion', nav: false }
        ]);
        this.router = router;
    };
    return App;
}());
exports.App = App;
function configure(aurelia) {
    aurelia.use
        .standardConfiguration()
        .developmentLogging()
        .globalResources(['assets/custom-elements/TopNavigationCustomElement', 'assets/custom-elements/BottomNavigationCustomElement', 'assets/custom-elements/SbtLinkCustomElement']);
    aurelia.start().then(function () { return aurelia.setRoot('app'); });
}
exports.configure = configure;
//# sourceMappingURL=app.js.map

除此之外,我的所有输出都会破坏应用程序(使aurelia框架调用configure方法两次,但是他的输出工作正常)。

任何人都知道发生了什么事? 该项目是在VS2013中创建的,大约在升级到VS2015之前一个月,如果有任何影响的话。

输出打字稿项目设置如下: Visual Studio project settings

1 个答案:

答案 0 :(得分:0)

问题解决了。我的同事VS根本没有透露ts文件。他的输出来自commonJS,但在更改为System之后,VS不再编译js文件。删除js文件的内容并再次保存ts文件给了他与我相同的输出。所以看起来像是VS VS