-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
42 lines (39 loc) · 1.07 KB
/
gulpfile.js
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
const gulp = require('gulp');
const watch = require('gulp-watch');
const plumber = require('gulp-plumber');
const sourcemaps = require('gulp-sourcemaps');
const babel = require('gulp-babel');
const header = require('gulp-header');
const compileSrc = function (source) {
return source
.pipe(plumber())
.pipe(header("import 'core-js/stable';import 'regenerator-runtime/runtime';import 'source-map-support/register';"))
.pipe(sourcemaps.init())
.pipe(babel({
presets: [
["@babel/preset-env", {
"exclude": [ "@babel/plugin-transform-exponentiation-operator" ]
}]
],
plugins: [
"@babel/transform-async-to-generator",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-syntax-bigint",
[
"module-resolver", {
"alias": {
"akso": "./dist"
}
}
]
]
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'))
};
gulp.task('compile-src', function () {
return compileSrc(gulp.src(['src/**/*.js']));
});
gulp.task('watch-compile', function () {
compileSrc(watch(['src/**/*.js']));
});