I am attempting to create the following directory structure
-- src
|__ app
|__ x.ts
|__ test
|__ y.ts
-- build
|__ app
|__ js
|__ test
|__ js
My goal is to have my generated js files inside build/app and build/test when running "gulp compile". This means I need multiple sources going to multiple destinations. I want to avoid creating a new gulp target for the test one. Below are two methods I am using to achieve this task.
gulp.task('compile', function () {
//path to src/app typescript files
var app_js = gulp.src('./src/app/**/*.ts')
.pipe(tsc(tsProject))
//path to src/test typescript files
var test_js = gulp.src('./src/test/**/*.ts')
.pipe(tsc(tsProject));
return merge([
app_js.js.pipe(gulp.dest('./build/src/app/')),
test_js.js.pipe(gulp.dest('./build/src/test/'))
]);
});
gulp.task('bundle', function () {
var paths = [
{ src: './src/app/**/*.ts', dest: './build/src/app/' },
{ src: './src/test/**/*.ts', dest: './build/src/test/' }
];
var tasks = paths.map(function (path) {
return gulp.src(path.src).pipe(tsc(tsProject)).pipe(gulp.dest(path.dest));
})
return merge(tasks);
});
However, whenever I run "gulp compile" or "gulp bundle", I encounter the following issues
events.js:141 throw er; // Unhandled 'error' event ^Error: stream.push() after EOF at readableAddChunk (_stream_readable.js:132:15)
Could someone please advise me on what might be wrong here? NOTE: I have tried using both merge-stream and merge2 packages.