2016-09-14 273 views
0

我有以下tsconfig.json文件在ASP.NET核心:咕嘟咕嘟不產生嵌入sourcemaps

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "inlineSourceMap": true, 
    "inlineSources": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "noEmitOnError": false, 
    "noImplicitAny": false, 
    "removeComments": false, 
    "outDir": "wwwroot/client-app" 
}, 
    "exclude": [ 
    "node_modules", 
    "wwwroot", 
    "typings" 
    ] 
} 

當我通過Visual Studio生成項目所產生的js文件具有內嵌源在地圖的結束文件:

/// <reference path="../typings/index.d.ts" /> 
"use strict"; 
var platform_browser_dynamic_1 = require('@angular/platform-browser-dynamic'); 
var client_application_module_1 = require('./client-application.module'); 
platform_browser_dynamic_1.platformBrowserDynamic().bootstrapModule(client_application_module_1.ClientApplicationModule); 
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm9vdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL0NsaWVudEFwcC9ib290LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDhDQUE4Qzs7QUFFOUMseUNBQXVDLG1DQUFtQyxDQUFDLENBQUE7QUFDM0UsMENBQXdDLDZCQUE2QixDQUFDLENBQUE7QUFFdEUsaURBQXNCLEVBQUUsQ0FBQyxlQUFlLENBQUMsbURBQXVCLENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCIuLi90eXBpbmdzL2luZGV4LmQudHNcIiAvPlxyXG5cclxuaW1wb3J0IHsgcGxhdGZvcm1Ccm93c2VyRHluYW1pYyB9IGZyb20gJ0Bhbmd1bGFyL3BsYXRmb3JtLWJyb3dzZXItZHluYW1pYyc7XHJcbmltcG9ydCB7IENsaWVudEFwcGxpY2F0aW9uTW9kdWxlIH0gZnJvbSAnLi9jbGllbnQtYXBwbGljYXRpb24ubW9kdWxlJztcclxuXHJcbnBsYXRmb3JtQnJvd3NlckR5bmFtaWMoKS5ib290c3RyYXBNb2R1bGUoQ2xpZW50QXBwbGljYXRpb25Nb2R1bGUpOyJdfQ== 

但是,當我建立與咕嘟咕嘟的js文件,不產生內聯sourcemap,就像如果有人無視tsconfig.json

這裏是transpiling打字稿爲JavaScript我咕嘟咕嘟任務:

var tsProject = ts.createProject('tsconfig.json'); 

    gulp.task('transpile', function() 
    { 
     var tsResult = gulp.src(["ClientApp/**/*.ts"]) 
      .pipe(ts(tsProject), undefined, ts.reporter.fullReporter()).js 
      .pipe(gulp.dest('./wwwroot/client-app')); 
    }); 

我需要在咕嘟咕嘟任何額外的配置,以便可以生成內嵌sourcemaps?

我使用打字稿1.8.10

回答

1

我從來沒有設法得到它與簡單的打字稿一飲而盡任務工作時,我總是用一口-sourcemaps插件來做到這一點。

通常是這樣的:

var sourcemaps = require('gulp-sourcemaps'); 
var typescript = require('gulp-typescript'); 

gulp.task('typescript', function() { 
    gulp.src(["ClientApp/**/*.ts"]) 
     .pipe(sourcemaps.init()) 
     .pipe(typescript()) 
     .pipe(sourcemaps.write()) 
     .pipe(gulp.dest('./wwwroot/client-app'))  
});