2016-04-05 13 views
0

コンパイル時に、typescript - > es6 - > es5がソースマップに問題があるようです。 私はtypescriptソースマップを取得したいですが、ルートディレクトリのファイルに対してのみ生成されます。 ネストされたフォルダの場合は、t6のないes6ソースマップのみが生成されました。 ScreenshotTypescript - > es6 - > es5 error with sourcemaps

ツール: 一気-TSB:1.10.0、 一息-バベル:6.1.2、 一息-sourcemaps:TSconfigの中^ 1.3.0

オプション:

"compilerOptions": { 
"rootDir": "src/", 
"sourceMap": true, 
"target": "es6", 
"module": "commonjs", 
"declaration": false, 
"noImplicitAny": false, 
"noResolve": true, 
"removeComments": true, 
"noLib": false, 
"emitDecoratorMetadata": true, 
"experimentalDecorators": true  
} 

マイ一気タスク:

var typescriptCompiler = typescriptCompiler || null; 
    gulp.task('build-system', function() { 
    if(!typescriptCompiler) { 
     typescriptCompiler = typescript.create(require('../../tsconfig.json').compilerOptions); 
} 
    return gulp.src(paths.dtsSrc.concat(paths.source)) 
    .pipe(plumber()) 
    .pipe(sourcemaps.init({loadMaps: true})) 
    .pipe(typescriptCompiler()) 
    .pipe(to5(assign({}, compilerOptions.commonjs()))) 
    .pipe(sourcemaps.write()) 
    .pipe(gulp.dest(paths.output)); 
}); 
+0

TypeScriptをES5にコンパイルする特別な理由は何ですか? –

+1

async/await。 async/awaitでtypescriptをes5にコンパイルすると、typescript 2.0で使用できます。 –

答えて

0

はいくつかのバグがあります。

TS > ES6 > JS conversion while preserving source maps from original *.ts files

I created a small repo with the code that shows the error: https://github.com/helios1138/--babel-sourcemaps-error-case

clone, npm install and run ./build.sh to see Invalid mapping error

It looks like changes in TS2.0+ prevent a relative sourceMapUrl from being generated despite the adding the mapRoot attribute in the tsconfig.json

参照

関連する問題