2016-04-05 24 views
0

typescript derleme ile> ES5 hata> ES5 sourcemaps ile ilgili bir sorun görünür. Ben typescript sourcemaps almak istiyorum ama kök dizininde dosyalar için sadece üretti. iç içe klasörler için ts olmadan yalnızca ES6 sourcemaps üretti. Screenshottypescript -> ES6 - -> ES6 - sourcemaps

Araçları: yudum-tsb: 1.10.0, yudum-babel: 6.1.2, yudum-sourcemaps: tsconfig içinde^1.3.0

Seçenekler:

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

Benim yudum görev:

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

Sadece belirli bir nedenle, TypeScript'i ES5'e derlemiyor musunuz? –

+1

uyumsuz/beklemektedir. zaman uyumsuz ile ES5 için typescript derleme/bekliyoruz typescript 2.0 DAİREMİZ olacaktır. –

cevap

0

birkaç hata vardır:

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

Kaynaklar