如何将Webpack生成的文件传递给Gulp流

时间:2014-06-20 08:21:01

标签: javascript gulp webpack

考虑到以下Webpack Gulp任务,如何将这与Gulp集成,以便在编译Webpack之后将文件传输到Gulp以便我可以运行更多任务?

gulp.task('webpack', function(callback) {
  webpackCompiler.run(function(err, stats) {
    if (err) {
      throw new plugins.util.PluginError('webpack', err);
    }
    plugins.util.log('webpack', stats.toString({
      colors: true,
    }));
    callback();
  });
});

gulp.task('set-env-dev', function() {
  webpackConfig.plugins = [
    new webpack.BannerPlugin(info.name + '\n' + info.version + ':' + Date.now() + ' [development build]'),
    new ComponentPlugin()
  ];
  webpackCompiler = webpack( webpackConfig );
});

1 个答案:

答案 0 :(得分:8)

现在有一个Gulp插件允许更深入地集成Webpack和Gulp: https://github.com/shama/webpack-stream