ext-webpack

Webpack project builder. webpack configuration file is loaded first if available. And then, it is overridden with rtb.moduleOptions.webpack settings if available.

If rtb.conf.src(BuildConfig.src) is specified, it will override the 'entry' value of webpack configuration. A string or an array of string is allowed, but it cannot specify multiple entry points. To configure multiple entry points, use moduleOptions.webpack option or separate webpack configuration file.

If rtb.conf.dest(BuildConfig.dest) is specified, it will override output.path of webpack configuration.

If rtb.conf.outFile(BuildConfig.outFile) is specified, it will override output.filename of webpack configuration.

To enable sourceMap, add devtool option to webpack configuration file. For more details, refer to webpack documentation on Devtool.

Usage

rtb.webpack(options={});

Options

options will override rtb.moduleOptions. Following options are available additionally.

OptionTypeDefaultDescription
configFilestringundefinedConfig file name to override buildOptions.webpackConfig.

rtb.buildOptions (BuildConfig.buildOptions)

OptionTypeDefaultDescription
webpackConfigstringundefinedwebpack config file name.
printConfigbooleanfalsePrint webpack config settings actually used.

rtb.moduleOptions (BuildConfig.moduleOptions)

propertytypedefaultdescription
webpackObject{}Options to gulp-webpack.

Example

const tron = require('gulp-tron');
const coffee = {
name: 'coffee',
builder: (rtb) => rtb.src().coffee().dest(),
src: ['assets/coffee/**/*.coffee'],
dest: 'www/js',
outFile: 'sample-coffee.js',
buildOptions: { babel: true },
npmInstall: ['@babel/preset-env']
};

Notes

This extension is for custom processing. Use GWebpackBuilder for webpack processiing.