McBooley McBooley - 5 months ago 107
Javascript Question

Gulp TypeError: dest.on is not a function

I'm trying to generate a bundle.js with a Gulp task

var gulp = require('gulp'),
gutil = require('gulp-util'),
wrench = require('wrench'),
conf = require('./webpack.config'),
webpack = require('webpack'),
WebpackDevServer = require('webpack-dev-server');

// Webpack
gulp.task('wp', function() {
return gulp.src('./assets/scripts/entry.js')

and when I try to run it, I get TypeError: dest.on is not a function.
enter image description here

enter image description here

Also here's the folder directory


The error occurs because webpack doesn't work natively with gulp streams. Naturally the returned object by webpack() doesn't include dest.on which is specific to gulp.

Either use gulp-webpack or follow the official docs on how to use webpack with gulp

Sample code taken straight out of the official docs which uses webpack-stream:

var gulp = require('gulp');
var webpack = require('webpack-stream');

gulp.task('default', function() {
  return gulp.src('src/entry.js')