diff --git a/lib/compiler.js b/lib/compiler.js index c4f0c1d..ad38889 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -50,7 +50,11 @@ module.exports.compileTemplate = function compileTemplate(template, context, out new SingleEntryPlugin(this.context, template), new LoaderTargetPlugin('node') ); - childCompiler.plugin("compilation", function(compilation) { + + // Fix for "Uncaught TypeError: __webpack_require__(...) is not a function" + // Hot module replacement requires that every child compiler has its own + // cache. @see https://github.com/ampedandwired/html-webpack-plugin/pull/179 + childCompiler.plugin('compilation', function(compilation) { if(compilation.cache) { if(!compilation.cache[compilerName]) compilation.cache[compilerName] = {}; diff --git a/package.json b/package.json index cdf3cf4..b932873 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "html-webpack-plugin", - "version": "2.6.3", + "version": "2.6.4", "description": "Simplifies creation of HTML files to serve your webpack bundles", "main": "index.js", "files": [