Pass Gulp sources to gulp-coffee, gulp-concat, and webpack-stream

筅森魡賤 提交于 2019-12-13 16:20:49

问题


I have the code:

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

gulp.task('webpack', function() {
  gulp.src('*/lib/*.coffee', { base: '.' })
    .pipe(coffee({ bare: true }))
    .pipe(concat('app.js'))
    .pipe(webpack())
    .pipe(gulp.dest('.'));
});

However, it doesn't work, when it reaches webpack(). How can I make it so that the content passed from concat() to webpack() works successfully?

I also assume that if I removed the concat() pipe, and went straight from coffee() to webpack(), then I'd end up with multiple files processed by webpack() rather than a single one, right?

I tried using coffee-loader for Webpack, but for some reason it outputs content with bare: false (when I look at the output file), even though in the actual package, it appears that it's hardcoded to output with bare: true. So that's why I'm using gulp-coffee instead.

来源:https://stackoverflow.com/questions/38253175/pass-gulp-sources-to-gulp-coffee-gulp-concat-and-webpack-stream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!