我正在尝试更新到webpack 2.我使用webpack-stream从gulp运行东西,但似乎webpack-stream正在使用它自己对webpack的依赖,这是webpack 1。
我无法在webpack 2中找到任何webpack-stream 2.是否有可能从gulp使用webpack 2?
答案 0 :(得分:38)
您需要同时安装webpack
和webpack-stream
:
npm install --save-dev webpack-stream
npm install --save-dev webpack@2.1.0-beta.25
然后,您可以将webpack
对象作为第二个参数传递给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/'));
});