Skip to content

Commit

Permalink
feat: Allow to use console.log inside templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jantimon committed Apr 30, 2020
1 parent 8359c69 commit c3f2fdc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c3f2fdc

Please sign in to comment.