unbroken-dome / indexhtml-webpack-plugin

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

Dev server crashes when rebuilding with image assets in index.html #10

Open bowd opened 8 years ago

bowd commented 8 years ago

Description

I have an index.html file that has 3 dependencies:

  1. A favicon file
  2. A logo
  3. the javascript build

When I start the webpack dev server all builds correctly and I get right assets. If I trigger a save on the index.html file, the webpack dev server crashes with this stacktrace:

/Users/bogdan/workspace/leeruniek/webclient-2.0/node_modules/webpack/lib/NormalModule.js:136
                var template = dependencyTemplates.get(dep.constructor);
                                                  ^
TypeError: Cannot read property 'get' of null
    at doDep (/Users/bogdan/workspace/leeruniek/webclient-2.0/node_modules/webpack/lib/NormalModule.js:136:37)
    at Array.forEach (native)
    at doBlock (/Users/bogdan/workspace/leeruniek/webclient-2.0/node_modules/webpack/lib/NormalModule.js:151:22)
    at DependenciesBlock.NormalModule.source (/Users/bogdan/workspace/leeruniek/webclient-2.0/node_modules/webpack/lib/NormalModule.js:186:2)
    at __webpack_require__ (/Users/bogdan/workspace/leeruniek/webclient-2.0/node_modules/indexhtml-webpack-plugin/IndexHtmlSource.js:117:39)
    at IndexHtmlSource._getHtmlFromModule (/Users/bogdan/workspace/leeruniek/webclient-2.0/node_modules/indexhtml-webpack-plugin/IndexHtmlSource.js:128:12)
    at IndexHtmlSource.source (/Users/bogdan/workspace/leeruniek/webclient-2.0/node_modules/indexhtml-webpack-plugin/IndexHtmlSource.js:25:21)
    at Compiler.writeOut (/Users/bogdan/workspace/leeruniek/webclient-2.0/node_modules/webpack/lib/Compiler.js:256:26)
    at Compiler.<anonymous> (/Users/bogdan/workspace/leeruniek/webclient-2.0/node_modules/webpack/lib/Compiler.js:246:20)
    at /Users/bogdan/workspace/leeruniek/webclient-2.0/node_modules/webpack/node_modules/async/lib/async.js:181:20

If I remove the icon and logo dependencies from the file modifying it doesn't trigger the crash.

How to reproduce

Checkout the repo: https://github.com/bogdan-dumitru/indexhtml-webpack-crash-issue Install dependencies and run gulp dev to start the dev server on localhost:3000. Open up the src/index.html file, modify it and save it -- it should result in the crash.

I'm looking into it as well now but any input would be helpful. Thanks!