Reputation: 9295
I am using tsconfig.json to compile my ts files. all my files ts located under src folder and I would like my output to be under dist folder. Here is my current output:
As you can see the structure doesn't kept. I would like to find test.js to be under: 'dist/controller/test.js'.
Here is my tsconfig.json file:
{
"compilerOptions": {
"target": "es6",
"sourceMap": true,
"outDir": "dist/"
},
"exclude": [
"node_modules"
]
}
And here is my gulp task:
var tsProject = ts.createProject('tsconfig.json');
gulp.task('scripts', () => {
var tsResult = tsProject.src()
.pipe(ts(tsProject));
return tsResult.js.pipe(gulp.dest('dist'));
});
Upvotes: 2
Views: 106
Reputation: 9295
I have to add rootDir to achieve it, take a look at my fixed tsconfig file:
{
"compilerOptions": {
"target": "es6",
"sourceMap": true,
"outDir": "dist/",
"rootDir": "./src"
},
"exclude": [
"node_modules"
]
}
Upvotes: 1