Yet another Webpack plugin (for Gulp)
After some time using webpack-stream
I hit a limitation with it: The vinyl object piped out is not the same one as the one piped in.
I need some custom properties on the vinyl objects for my gulp setup, so this was a show stopper. The custom properties were not available after the files were piped into the plugin.
I decided to fix this problem and PR, but as I read and understood the code I decided to change so much stuff that it was beyond a PR.
webpack-stream
creates some basic webpack configuration that applies. gulp-webpack-yawp
does not.
This plugin only works with Webpack 4.
npm i --save-dev gulp-webpack-yawp
Example gulp task:
const
{ src, dest } = require( 'gulp' ),
webpack = require( 'gulp-webpack-yawp' );
exports.default = function compileJs() {
return src( 'src/js/*.js' )
.pipe( webpack())
.pipe( dest( 'output/' )
}
The plugin accepts a configuration object with the following properties:
property | type | default | values | description |
---|---|---|---|---|
webpack | object | -- | -- | Webpack instance |
wpConfig | object | -- | -- | Webpack configuration |
logMode | string | 'silent' | 'silent', 'stats', 'verbose' | Webpack log mode |
statsOptions | object | [see below] | -- | Options for log mode 'stats' |
verbose | boolean | false | -- | Plugin verbose mode |
watch | boolean | false | -- | Use webpack in watch mode |
watchOptions | object | [see below] | -- | Options for watch mode |
A webpack instance. If passed it will be cached for subsequent usage.
A webpack configuration object.
Log mode for webpack to use. Choose between 'silent', 'verbose' or 'stats'.
If 'stats' is passed, an additional option can be used to specify what's going to get logged.
A stats options object for webpack to use.
Defaults to:
{
builtAt: false,
chunks: false,
children: false,
hash: false,
modules: false,
performance: true,
warnings: true,
}
Plugin verbosity.
Initiate webpack in watch mode. If true
, an additional watchOptions
object can be passed.
A watch options object.
Defaults to:
{
builtAt: false,
chunks: false,
colors: TERMINAL_HAS_COLOR,
children: false,
hash: false,
modules: false,
performance: true,
warnings: true,
}
This plugin supports:
npm run test
We use SemVer for versioning. For the versions available, see the tags on this repository.
Issues and PR are welcomed.
- Sergio Jiménez Herena - Initial work - crisisinaptica
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details
-
This plugin takes inspiration from webpack-stream by Kyle Robinson Young.
-
This template was used for the readme.