$ gulp -v
[08:52:07] Requiring external module babel-register
[08:52:07] CLI version 1.2.2
[08:52:07] Local version 4.0.0-alpha.2
error:
...
at Object.<anonymous> (build.js:9:20)
...
line 9:
const build = gulp.series(buildJs, buildPug);
build.js:
'use strict';
import gulp from 'gulp';
import buildJs from './js'
import buildPug from './pug'
const build = gulp.series(buildJs, buildPug);
gulp.task('build', build);
export { build };
js.js:
'use strict';
import gulp from 'gulp'
import babel from 'gulp-babel'
import webpack from 'webpack-stream'
import concat from 'gulp-concat'
import uglify from 'gulp-uglify'
import plumber from 'gulp-plumber'
import { src, names, dest } from '../paths'
/* -------------------- JS */
//Reload
function reloadJs() {
return gulp.src(src.js)
.pipe(plumber())
//.pipe(concat(names.js))
.pipe(babel({
presets: ['es2015']
}))
.pipe(webpack( require('../webpack.config.js') ))
.pipe(gulp.dest(dest.js))
}
//Build
function buildJs() {
return gulp.src(src.js)
.pipe(plumber())
//.pipe(concat(names.js))
.pipe(babel({
presets: ['es2015']
}))
.pipe(webpack( require('../webpack.config.js') ))
.pipe(uglify())
.pipe(gulp.dest(dest.js))
}
export { buildJs, reloadJs };
pug.js:
'use strict';
import gulp from 'gulp';
import pug from 'gulp-pug';
import plumber from 'gulp-plumber';
import notify from 'gulp-notify';
import { src, names, dest } from '../paths'
import { config } from '../config'
/* -------------------- PugJs */
//Reload
function reloadPug() {
return gulp.src(src.pug)
.pipe(plumber())
.pipe(pug({
locals: config.pug.locals,
pretty: true
}))
.pipe(gulp.dest(dest.html))
}
//Build
function buildPug() {
return gulp.src(src.pug)
.pipe(plumber())
.pipe(pug({
locals: config.pug.locals
}))
.pipe(notify(config.msg.build.pug))
.pipe(gulp.dest(dest.html))
}
export { buildPug, reloadPug };
Nobody answered the same question on SO
_repo removed_
Even if i change build.js in that repo to:
import gulp from 'gulp';
import babel from 'gulp-babel';
import pug from 'gulp-pug';
const paths = {
pug: {
src: './sources/html/**/*.pug',
dest: './dist/'
}
};
export function buildPug() {
return gulp.src(paths.pug.src)
.pipe(pug({
locals: {}
}))
.pipe(gulp.dest(paths.pug.dest))
}
export function watch() {
gulp.watch(paths.pug.src, buildPug);
}
const build = gulp.series(buildPug);
export { build };
/*
* Export a default task
*/
export default build;
it doesnt' work:
$ gulp
[09:49:09] Requiring external module babel-register
[09:49:10] Using gulpfile D:\Development\Projects\gulp-issue-1767\gulpfile.babel
.js
[09:49:10] Task never defined: default
[09:49:10] To list available tasks, try running: gulp --tasks
Your gulpfile doesn't export anything; it only imports. The imports shorthands only work in the gulpfile, not throughout the runtime. Sorry no one answered your StackOverflow question, but this is not a support forum.
Most helpful comment
Your gulpfile doesn't export anything; it only imports. The imports shorthands only work in the gulpfile, not throughout the runtime. Sorry no one answered your StackOverflow question, but this is not a support forum.