Skip to content Skip to sidebar Skip to footer

Typescript Tsconfig Output Files In Certain Folders

I am trying to have 3 folders (ts,js,map)... 1 for TS, 1 for compiled js, and 1 for the map files. Is this not possible? I have seen a couple of questions on here, but didn't fin

Solution 1:

You are on the right track. Use the "outDir" in your tsconfig.json to set the out location of you want the transpiled.js to go, then use a task such as a gulp, grunt or custom -- to copy the map.js files to the desired location.

The sourceRoot and sourceMap don't do what you think they do. They just allow you to specify a path within the sourceMap where your browser should expect to find the map and source ts. They don't alter where they are output.

example gulpfile.js

var gulp = require('gulp');
var del = require('del');

gulp.task('move' => () {
    gulp.src(['app/js/**/*.map.js'])
        .pipe(del())
        .pile(dest('app/map'))
})

Something like that should work.

Post a Comment for "Typescript Tsconfig Output Files In Certain Folders"