diff --git a/index.ts b/index.ts
index be2b7630f..42eb4fdfb 100644
--- a/index.ts
+++ b/index.ts
@@ -404,6 +404,12 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {
var getCompilerOptionDiagnostics = true;
loader._compiler.plugin("after-compile", (compilation, callback) => {
+ // Don't add errors for child compilations
+ if (compilation.compiler.isChild()) {
+ callback();
+ return;
+ }
+
let stats = compilation.stats;
// handle all other errors. The basic approach here to get accurate error
diff --git a/package.json b/package.json
index 1e14991f4..d94d0e48c 100644
--- a/package.json
+++ b/package.json
@@ -40,6 +40,7 @@
"escape-string-regexp": "^1.0.3",
"fs-extra": "^0.22.1",
"glob": "^6.0.3",
+ "html-webpack-plugin": "^2.8.1",
"mkdirp": "^0.5.1",
"mocha": "^2.1.0",
"rimraf": "^2.4.2",
diff --git a/test/html-webpack-plugin/app.ts b/test/html-webpack-plugin/app.ts
new file mode 100644
index 000000000..ad86b2ec3
--- /dev/null
+++ b/test/html-webpack-plugin/app.ts
@@ -0,0 +1 @@
+console.log("hello");
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.6/bundle.js b/test/html-webpack-plugin/expectedOutput-1.6/bundle.js
new file mode 100644
index 000000000..3b76e1bde
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.6/bundle.js
@@ -0,0 +1,51 @@
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports) {
+
+ console.log("hello");
+
+
+/***/ }
+/******/ ]);
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.6/index.html b/test/html-webpack-plugin/expectedOutput-1.6/index.html
new file mode 100644
index 000000000..8a7f3ef8b
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.6/index.html
@@ -0,0 +1,9 @@
+
+
+
+
+ Webpack App
+
+
+
+
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.6/output.txt b/test/html-webpack-plugin/expectedOutput-1.6/output.txt
new file mode 100644
index 000000000..20871bb11
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.6/output.txt
@@ -0,0 +1,12 @@
+ Asset Size Chunks Chunk Names
+ bundle.js 1.41 kB 0 [emitted] main
+index.html 159 bytes [emitted]
+chunk {0} bundle.js (main) 22 bytes [rendered]
+ [0] ./.test/html-webpack-plugin/app.ts 22 bytes {0} [built]
+Child html-webpack-plugin for "index.html":
+ Asset Size Chunks Chunk Names
+ index.html 426 kB 0
+ chunk {0} index.html 412 kB [rendered]
+ [0] ./~/html-webpack-plugin/lib/loader.js!./~/html-webpack-plugin/default_index.ejs 356 bytes {0} [built]
+ [1] ./~/html-webpack-plugin/~/lodash/index.js 411 kB {0} [built]
+ [2] (webpack)/buildin/module.js 241 bytes {0} [built]
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.7/bundle.js b/test/html-webpack-plugin/expectedOutput-1.7/bundle.js
new file mode 100644
index 000000000..3b76e1bde
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.7/bundle.js
@@ -0,0 +1,51 @@
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports) {
+
+ console.log("hello");
+
+
+/***/ }
+/******/ ]);
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.7/index.html b/test/html-webpack-plugin/expectedOutput-1.7/index.html
new file mode 100644
index 000000000..8a7f3ef8b
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.7/index.html
@@ -0,0 +1,9 @@
+
+
+
+
+ Webpack App
+
+
+
+
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.7/output.txt b/test/html-webpack-plugin/expectedOutput-1.7/output.txt
new file mode 100644
index 000000000..20871bb11
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.7/output.txt
@@ -0,0 +1,12 @@
+ Asset Size Chunks Chunk Names
+ bundle.js 1.41 kB 0 [emitted] main
+index.html 159 bytes [emitted]
+chunk {0} bundle.js (main) 22 bytes [rendered]
+ [0] ./.test/html-webpack-plugin/app.ts 22 bytes {0} [built]
+Child html-webpack-plugin for "index.html":
+ Asset Size Chunks Chunk Names
+ index.html 426 kB 0
+ chunk {0} index.html 412 kB [rendered]
+ [0] ./~/html-webpack-plugin/lib/loader.js!./~/html-webpack-plugin/default_index.ejs 356 bytes {0} [built]
+ [1] ./~/html-webpack-plugin/~/lodash/index.js 411 kB {0} [built]
+ [2] (webpack)/buildin/module.js 241 bytes {0} [built]
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.8/bundle.js b/test/html-webpack-plugin/expectedOutput-1.8/bundle.js
new file mode 100644
index 000000000..3b76e1bde
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.8/bundle.js
@@ -0,0 +1,51 @@
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports) {
+
+ console.log("hello");
+
+
+/***/ }
+/******/ ]);
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.8/bundle.transpiled.js b/test/html-webpack-plugin/expectedOutput-1.8/bundle.transpiled.js
new file mode 100644
index 000000000..56c9a1b99
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.8/bundle.transpiled.js
@@ -0,0 +1,52 @@
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports) {
+
+ "use strict";
+ console.log("hello");
+
+
+/***/ }
+/******/ ]);
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.8/index.html b/test/html-webpack-plugin/expectedOutput-1.8/index.html
new file mode 100644
index 000000000..8a7f3ef8b
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.8/index.html
@@ -0,0 +1,9 @@
+
+
+
+
+ Webpack App
+
+
+
+
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.8/output.transpiled.txt b/test/html-webpack-plugin/expectedOutput-1.8/output.transpiled.txt
new file mode 100644
index 000000000..6dbcacfe6
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.8/output.transpiled.txt
@@ -0,0 +1,12 @@
+ Asset Size Chunks Chunk Names
+ bundle.js 1.43 kB 0 [emitted] main
+index.html 159 bytes [emitted]
+chunk {0} bundle.js (main) 36 bytes [rendered]
+ [0] ./.test/html-webpack-plugin/app.ts 36 bytes {0} [built]
+Child html-webpack-plugin for "index.html":
+ Asset Size Chunks Chunk Names
+ index.html 426 kB 0
+ chunk {0} index.html 412 kB [rendered]
+ [0] ./~/html-webpack-plugin/lib/loader.js!./~/html-webpack-plugin/default_index.ejs 356 bytes {0} [built]
+ [1] ./~/html-webpack-plugin/~/lodash/index.js 411 kB {0} [built]
+ [2] (webpack)/buildin/module.js 241 bytes {0} [built]
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.8/output.txt b/test/html-webpack-plugin/expectedOutput-1.8/output.txt
new file mode 100644
index 000000000..20871bb11
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.8/output.txt
@@ -0,0 +1,12 @@
+ Asset Size Chunks Chunk Names
+ bundle.js 1.41 kB 0 [emitted] main
+index.html 159 bytes [emitted]
+chunk {0} bundle.js (main) 22 bytes [rendered]
+ [0] ./.test/html-webpack-plugin/app.ts 22 bytes {0} [built]
+Child html-webpack-plugin for "index.html":
+ Asset Size Chunks Chunk Names
+ index.html 426 kB 0
+ chunk {0} index.html 412 kB [rendered]
+ [0] ./~/html-webpack-plugin/lib/loader.js!./~/html-webpack-plugin/default_index.ejs 356 bytes {0} [built]
+ [1] ./~/html-webpack-plugin/~/lodash/index.js 411 kB {0} [built]
+ [2] (webpack)/buildin/module.js 241 bytes {0} [built]
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.9/bundle.js b/test/html-webpack-plugin/expectedOutput-1.9/bundle.js
new file mode 100644
index 000000000..3b76e1bde
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.9/bundle.js
@@ -0,0 +1,51 @@
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports) {
+
+ console.log("hello");
+
+
+/***/ }
+/******/ ]);
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.9/bundle.transpiled.js b/test/html-webpack-plugin/expectedOutput-1.9/bundle.transpiled.js
new file mode 100644
index 000000000..56c9a1b99
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.9/bundle.transpiled.js
@@ -0,0 +1,52 @@
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports) {
+
+ "use strict";
+ console.log("hello");
+
+
+/***/ }
+/******/ ]);
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.9/index.html b/test/html-webpack-plugin/expectedOutput-1.9/index.html
new file mode 100644
index 000000000..8a7f3ef8b
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.9/index.html
@@ -0,0 +1,9 @@
+
+
+
+
+ Webpack App
+
+
+
+
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.9/output.transpiled.txt b/test/html-webpack-plugin/expectedOutput-1.9/output.transpiled.txt
new file mode 100644
index 000000000..6dbcacfe6
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.9/output.transpiled.txt
@@ -0,0 +1,12 @@
+ Asset Size Chunks Chunk Names
+ bundle.js 1.43 kB 0 [emitted] main
+index.html 159 bytes [emitted]
+chunk {0} bundle.js (main) 36 bytes [rendered]
+ [0] ./.test/html-webpack-plugin/app.ts 36 bytes {0} [built]
+Child html-webpack-plugin for "index.html":
+ Asset Size Chunks Chunk Names
+ index.html 426 kB 0
+ chunk {0} index.html 412 kB [rendered]
+ [0] ./~/html-webpack-plugin/lib/loader.js!./~/html-webpack-plugin/default_index.ejs 356 bytes {0} [built]
+ [1] ./~/html-webpack-plugin/~/lodash/index.js 411 kB {0} [built]
+ [2] (webpack)/buildin/module.js 241 bytes {0} [built]
\ No newline at end of file
diff --git a/test/html-webpack-plugin/expectedOutput-1.9/output.txt b/test/html-webpack-plugin/expectedOutput-1.9/output.txt
new file mode 100644
index 000000000..20871bb11
--- /dev/null
+++ b/test/html-webpack-plugin/expectedOutput-1.9/output.txt
@@ -0,0 +1,12 @@
+ Asset Size Chunks Chunk Names
+ bundle.js 1.41 kB 0 [emitted] main
+index.html 159 bytes [emitted]
+chunk {0} bundle.js (main) 22 bytes [rendered]
+ [0] ./.test/html-webpack-plugin/app.ts 22 bytes {0} [built]
+Child html-webpack-plugin for "index.html":
+ Asset Size Chunks Chunk Names
+ index.html 426 kB 0
+ chunk {0} index.html 412 kB [rendered]
+ [0] ./~/html-webpack-plugin/lib/loader.js!./~/html-webpack-plugin/default_index.ejs 356 bytes {0} [built]
+ [1] ./~/html-webpack-plugin/~/lodash/index.js 411 kB {0} [built]
+ [2] (webpack)/buildin/module.js 241 bytes {0} [built]
\ No newline at end of file
diff --git a/test/html-webpack-plugin/index.html b/test/html-webpack-plugin/index.html
new file mode 100644
index 000000000..8a7f3ef8b
--- /dev/null
+++ b/test/html-webpack-plugin/index.html
@@ -0,0 +1,9 @@
+
+
+
+
+ Webpack App
+
+
+
+
\ No newline at end of file
diff --git a/test/html-webpack-plugin/tsconfig.json b/test/html-webpack-plugin/tsconfig.json
new file mode 100644
index 000000000..01e163ec5
--- /dev/null
+++ b/test/html-webpack-plugin/tsconfig.json
@@ -0,0 +1,6 @@
+{
+ "compilerOptions": {
+ },
+ "files": [
+ ]
+}
\ No newline at end of file
diff --git a/test/html-webpack-plugin/webpack.config.js b/test/html-webpack-plugin/webpack.config.js
new file mode 100644
index 000000000..953397795
--- /dev/null
+++ b/test/html-webpack-plugin/webpack.config.js
@@ -0,0 +1,23 @@
+var path = require('path')
+var HtmlWebpackPlugin = require('html-webpack-plugin');
+
+module.exports = {
+ entry: './app.ts',
+ output: {
+ filename: 'bundle.js'
+ },
+ resolve: {
+ extensions: ['', '.ts', '.js']
+ },
+ plugins: [
+ new HtmlWebpackPlugin({})
+ ],
+ module: {
+ loaders: [
+ { test: /\.ts$/, loader: 'ts-loader' }
+ ]
+ }
+}
+
+// for test harness purposes only, you would not need this in a normal project
+module.exports.resolveLoader = { alias: { 'ts-loader': require('path').join(__dirname, "../../index.js") } }
\ No newline at end of file