diff --git a/lib/compiler.js b/lib/compiler.js
index <HASH>..<HASH> 100644
--- a/lib/compiler.js
+++ b/lib/compiler.js
@@ -50,6 +50,13 @@ module.exports.compileTemplate = function compileTemplate(template, context, out
     new SingleEntryPlugin(this.context, template),
     new LoaderTargetPlugin('node')
   );
+  childCompiler.plugin("compilation", function(compilation) {
+    if(compilation.cache) {
+      if(!compilation.cache[compilerName])
+        compilation.cache[compilerName] = {};
+      compilation.cache = compilation.cache[compilerName];
+    }
+  });
 
   // Compile and return a promise
   return new Promise(function (resolve, reject) {
Use a separate cache for the child compilation.

Sharing the cache cause bad issues with wrong module ids.