unbroken-dome / indexhtml-webpack-plugin

Index HTML plugin for Webpack
MIT License
42 stars 5 forks source link

Swallows compilation errors from rest of build pipeline #11

Open akre54 opened 8 years ago

akre54 commented 8 years ago

If there's an error in the compilation process somewhere (say a SyntaxError in my JS when piped through babel), IndexHtmlWebpackPlugin will swallow the error and I'll get this TypeError instead:

/Project/node_modules/indexhtml-webpack-plugin/IndexHtmlSource.js:154
                    var chunkJsFile = _.find(chunkForEntry.files, function (file) {
                                                          ^

TypeError: Cannot read property 'files' of undefined
  at Object.<anonymous> (/Project/node_modules/indexhtml-webpack-plugin/IndexHtmlSource.js:154:59)
  at [object Object].exports.each (/Project/node_modules/cheerio/lib/api/traversing.js:293:24)
  at IndexHtmlSource._resolveScripts (/Project/node_modules/indexhtml-webpack-plugin/IndexHtmlSource.js:141:17)
  at IndexHtmlSource.source (/Project/node_modules/indexhtml-webpack-plugin/IndexHtmlSource.js:28:10)
  at CompressionPlugin.<anonymous> (/Project/node_modules/compression-webpack-plugin/index.js:31:25)
  at /Project/node_modules/compression-webpack-plugin/node_modules/async/lib/async.js:111:13
  at Array.forEach (native)
  at _each (/Project/node_modules/compression-webpack-plugin/node_modules/async/lib/async.j
  ...

Commenting out the IndexHtmlPlugin line in my webpack.config.js allows the error to go through correctly.

yrtimiD commented 8 years ago

In my case error appear if I remove either exclude or files section from tsconfig.json and I use ts-loader