-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
48 lines (39 loc) · 1.1 KB
/
Copy pathgulpfile.js
File metadata and controls
48 lines (39 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var gulp = require('gulp');
var clean = require('gulp-clean');
var PluginError = require("plugin-error");
var ts = require('gulp-typescript');
var webpack = require('webpack');
var tsProject = ts.createProject('src/tsconfig.json');
// Utility Functions
function handleError(err) {
throw new PluginError("Build failed", err.message);
process.exit(1);
}
gulp.task('clean', function() {
return gulp.src(['build'], {read: false, allowEmpty: true}).pipe(clean());
});
gulp.task('ts', function () {
return tsProject.src()
.pipe(tsProject())
.on('error', handleError)
.pipe(gulp.dest('build'));
});
gulp.task('webpack', function (callback) {
// run webpack
webpack({
entry: {
frontend: './build/frontend/index.js',
player: './build/player/index.js',
},
output: {
filename: "[name].js",
path: __dirname + "/build/static"
},
mode: 'development',
devtool: 'source-map-inline',
}, function (err, stats) {
if (err) throw new PluginError("webpack", err);
callback();
});
});
gulp.task('default', gulp.series('clean', 'ts', 'webpack'));