From 4785281713a547d62a71e024d63d5353c73c86b2 Mon Sep 17 00:00:00 2001 From: Avery Larsen Date: Tue, 28 Apr 2020 11:30:59 -0700 Subject: [PATCH] Update example to account for object merging PR #1331 introduces new behavior that merges a passed object with the defaults. --- .../template-parameters/webpack.config.js | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/examples/template-parameters/webpack.config.js b/examples/template-parameters/webpack.config.js index 535562b2..bf76f0a1 100755 --- a/examples/template-parameters/webpack.config.js +++ b/examples/template-parameters/webpack.config.js @@ -11,20 +11,24 @@ module.exports = { }, plugins: [ new HtmlWebpackPlugin({ - // NOTE if you pass plain object it will be passed as is. no default values there, so be aware! - // for implementation detail, please see index.js and search for "userOptions" variable - templateParameters: (compilation, assets, assetTags, options) => { - return { - compilation, - webpackConfig: compilation.options, - htmlWebpackPlugin: { - tags: assetTags, - files: assets, - options - }, - 'foo': 'bar' - }; + // If you pass a plain object, it will be merged with the default values + // (New in version 4) + templateParameters: { + 'foo': 'bar' }, + // Or if you want full control, pass a function + // templateParameters: (compilation, assets, assetTags, options) => { + // return { + // compilation, + // webpackConfig: compilation.options, + // htmlWebpackPlugin: { + // tags: assetTags, + // files: assets, + // options + // }, + // 'foo': 'bar' + // }; + // }, template: 'index.ejs' }) ]