shama / webpack-stream

:tropical_drink: Run webpack through a stream interface
MIT License
1.4k stars 123 forks source link

Is this supposed to work with gulp 4.0 #213

Closed ppozniak closed 5 years ago

ppozniak commented 5 years ago

Is this supposed to work with new gulp 4.0? I'm getting this error on tasks that use webpack-stream

Did you forget to signal async completion?
The following tasks did not complete: ...

One of my settings:

return gulp.src('./src/popup/popup.js')
    .pipe(
      webpack(
        Object.assign({}, SHARED_WEBPACK_SETTINGS, {
          output: {
            filename: 'app.js',
          },
        })
      )
    )
    .pipe(replace('})(undefined);', '})(window);'))
    .pipe(gulp.dest(`${dest}popup`));

I've also tried providing the callback but that doesn't change anything.

Any ideas?

jackmcpickle commented 5 years ago

Finally found a good solution to webpack 4

Doesn't work

const { src, dest } = require('gulp');
const webpack = require('webpack-stream');

const webpackTask = () => {
  return src('src/entry.js')
    .pipe(webpack())
    .pipe(dest('dist/'));
};

Doesn't work.

const webpackTask = (done) => {
  src('src/entry.js')
    .pipe(webpack());
    .pipe(dest('dist/'));
  done();
};

Works!

const webpackTask = (done) => {
  src('src/entry.js')
    .pipe(webpack());
    .pipe(dest('dist/'))
    .on('end', done);
};
ppozniak commented 5 years ago

The issue was caused by uglify plugin and has nothing to do with webpack stream, sorry.

xmeltrut commented 5 years ago

I'm getting the same issue and the suggested workaround does not work for me.

Is there a way I can see more information about the error @ppozniak ? I'm not sure what to report on the uglify plugin issue tracker.