gulp-webpack-through2
Run WebPack with through2 for gulp.
Usage
var gulp = require('gulp');
var webpack = require('gulp-webpack-through2');
gulp.task('default', function() {
return gulp.src('src/entry.js')
.pipe(webpack({
watch: true,
output: {
filename: '[name].bundle.js'
}
}, {
timings: true,
errorDetails: true
}))
.pipe(gulp.dest('build/'));
});
webpack(webpackConfig,statOptions)
-
webpackConfig
include webpackConfigprogress
show webpack progressverbose
show all stats informationcompress
配置不转换直接压缩的js文件,包含uglifyjs的配置
compress: { entry: { vendor: ['src/a.js', 'src/b.js'] }, compress:false //不压缩只合并 }, output: { filename: '[name].bundle.js' } //压缩合并`a.js`+ `b.js` => `wendor.bundle.js`
-
statsOptions
context
(string) context directory for request shorteninghash
add the hash of the compilationversion
add webpack version informationtimings
add timing informationassets
add assets informationchunks
add chunk information (setting this to false allows for a less verbose output)chunkModules
add built modules information to chunk informationmodules
add built modules informationchildren
add children informationcached
add also information about cached (not built) modulesreasons
add information about the reasons why modules are includedsource
add the source code of moduleserrorDetails
add details to errors (like resolving log)chunkOrigins
add the origins of chunks and chunk merging infomodulesSort
(string) sort the modules by that fieldchunksSort
(string) sort the chunks by that fieldassetsSort
(string) sort the assets by that field
Installation
$ npm install gulp-webpack-through2
Features
- 通过
gulp
运行webpack
- 配置
js
文件直接压缩不处理 |
Examples
To run the examples, clone the gulp-webpack-through2 repo and install the dependencies:
$ git clone git://github.com/Jetsly/gulp-webpack-through2
$ npm install gulp -g
$ npm install
$ gulp --gulpfile=example/gulpfile.js
Tests
To run the test suite, first install the dependencies, then run npm test
:
$ npm install
$ npm test