Using webpack 2 from gulp (webpack-stream for webpack 2)?

后端 未结 1 734
醉酒成梦
醉酒成梦 2020-12-31 06:22

I am trying to update to webpack 2. I use webpack-stream to run stuff from gulp, but it appears that webpack-stream is using it\'s own dependency on webpack which is webpack

相关标签:
1条回答
  • 2020-12-31 07:00

    You need to have both webpack and webpack-stream installed:

    npm install --save-dev webpack-stream
    npm install --save-dev webpack@2.1.0-beta.25
    

    Then you can pass the webpack object as the second parameter to webpack-stream:

    var gulp = require('gulp');
    var webpackStream = require('webpack-stream');
    var webpack2 = require('webpack');
    
    gulp.task('default', function() {
      return gulp.src('src/entry.js')
        .pipe(webpackStream({/* options */}, webpack2))
        .pipe(gulp.dest('dist/'));
    });
    
    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题