I'm trying to create a gulp task that transforms
TS -> (ES6) -> Babel -> (ES5) -> Webpack -> [bundle.js, bundle.js.map]
where the source map maps back to the original TS code.
How can I do this with gulp?
So far, I've managed to get it working from TS -> ES6 -> Babel -> ES5
// Build
gulp.task("build", ["clean"], () => {
const tsProject = ts.createProject("tsconfig.json", {});
const sourceMapOptions = {
sourceRoot: __dirname+"/src"
};
return tsProject.src()
.pipe(sourcemaps.init())
// Typescript
.pipe(tsProject())
.js
// Babel
.pipe(babel({
presets: ["es2015"],
plugins: ["transform-runtime"]
}))
// Webpack <-- ????
.pipe(webpack({})) // <-- ????
.pipe(sourcemaps.write(".", sourceMapOptions))
.pipe(gulp.dest("./dist"));
});
But have no idea how to add webpack to the mix.