From c3f2fdc6169678bfde4b4ebc1d60bc7a8745aa7d Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Wed, 29 Apr 2020 15:52:41 +0200 Subject: [PATCH] feat: Allow to use console.log inside templates --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 5c73c3c3..2d58ab54 100644 --- a/index.js +++ b/index.js @@ -306,7 +306,7 @@ class HtmlWebpackPlugin { // To extract the result during the evaluation this part has to be removed. source = source.replace('var HTML_WEBPACK_PLUGIN_RESULT =', ''); const template = this.options.template.replace(/^.+!/, '').replace(/\?.+$/, ''); - const vmContext = vm.createContext(_.extend({ HTML_WEBPACK_PLUGIN: true, require: require }, global)); + const vmContext = vm.createContext(_.extend({ HTML_WEBPACK_PLUGIN: true, require: require, console: console }, global)); const vmScript = new vm.Script(source, { filename: template }); // Evaluate code and cast to string let newSource;