Answer the question
In order to leave comments, you need to log in
Gulp 4 + browserify + error Watcher crashes on js error?
galp settings:
'use strict';
//TODO https://github.com/mrmlnc/emitty - optimize pug
const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');
const browserSync = require('browser-sync').create();
const gutil = require('gulp-util');
const browserify = require('browserify');
const watchify = require('watchify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const copyDir = 'front/fonts/**/*.*';
const assets = 'assets/';
gulp.task('javascript', function () {
// set up the browserify instance on a task basis
var b = browserify({
entries: './front/js/app.js',
debug: false
});
return b.bundle()
.pipe(plumber())
.pipe(source('bundle.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// Add transformation tasks to the pipeline here.
// .pipe(uglify())
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('public/' + assets + 'js'));
});
gulp.task('watch', function() {
gulp.watch('front/js/**/*.js', gulp.series('javascript'));
});
gulp.task('default',
gulp.series('build', gulp.parallel('watch', 'serve'))
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question