I have other sub templates which I am including in my main index.html. The screen doesn't refresh on changes in any of the subtemplates.
However it refreshes (all files) if I change something in index.html.
html-loader as the dev dependancyindex.html file:
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<%= require('html-loader!./test.html')%>
<div id="root"></div>
</body>
test.html file:
<script type="text/template" id="testting">
<div><%=name%> is the asa</div>
</script>
Node.js v8.12.0
linux 4.15.0-36-generic
[email protected]
[email protected]
The reason might be a bug here:
Maybe the childCompiler.fileDependencies does not include test.html.
Could you please add a console.log to your node_modules/html-webpack-plugin/lib/compiler.js to find out?
I will check that out now and update.
@jantimon Yes! That is indeed the case. Only index.html is in the fileDependencies.
Maybe @sokra can help out here.
@sokra shouldn't file dependencies be added here?
Yes it should be in fileDependencies
@sokra @jantimon Do you want me to file an issue in webpack's repo?
Maybe we can build a minimal reproduction example
@jantimon I have already made it while raising the issue itself. It was part of the template.
Check the OP above. I've made a very minimal repro.
I rather tough about an example without the html webpack plugin.
Just webpack, a minimal apply function plugin which starts a child compiler and a sub dependency.
So the webpack team can trace down the child compiler bug
@Aftabnack I opened a ticket for this issue: https://github.com/webpack/webpack/issues/8245
I was able to fix this problem by replacing this line:
with this one:
this.fileDependencies = Array.from(childCompilation.fileDependencies);
This code only extracts dependencies from the entry modules so file dependencies of dependencies of these modules are not tracked.
@jantimon - I can confirm that this change made it work. Would you like a PR?
@sokra, @jantimon - Thanks for the swift resolution, is there any place where I could understand the internal workings of webpack?? Probably a code annotated read?
I would like to be able to contribute to webpack ecosystem.
PS: For a second, it seemed to have slowed the dev startup a little, it works as fast before now.
@jantimon Any updates on when this will get merged?
I didn't see a PR for this yet, even though we know the solution.
Is there anything else needed from my side?
Sure - do you have time to prepare a pull request?
On it! Right away.
@jantimon Is it possible to make another beta release with this change if the 4.x stable is going to take longer? Looking forward for this one!!