From 8f086b9cae4dd6c136cf7273b78316c31ab4008b Mon Sep 17 00:00:00 2001 From: Robin van der Vleuten Date: Wed, 16 May 2018 09:16:14 +0200 Subject: [PATCH] Fallback to empty object when plugin is undefined. Fixes #2. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index fb07ba5..eb51719 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ module.exports = (config, env, helpers) => { const { stringified, raw } = resolveEnvVars('PREACT_APP_'); config.plugins.push(new DefinePlugin(stringified)); - const { plugin: htmlPlugin } = helpers.getPluginsByName(config, 'HtmlWebpackPlugin')[0]; + const { plugin: htmlPlugin } = helpers.getPluginsByName(config, 'HtmlWebpackPlugin')[0] || {}; if (htmlPlugin) { // Pass all prefixed env vars to the HTML template.