webpack-livereload-plugin
webpack-livereload-plugin copied to clipboard
Enable reload on custom logic
Usually page gets reloaded when compilation hash changes, but sometimes it may be desirable to reload even if hash stays the same. I.e. CopyWebpackPlugin
can emit changed files, but it doesn't change compilation hash, so the page doesn't reload. In this case you could check emitted files in options callback, to decide if reloading is required:
shouldReload(compilation) {
return Array.from(compilation.emittedAssets).some(assetName => path.extname(assetName) === '.php');
}
Maybe we could change the logic more globally/configureable.
- New option
useChildHash
(default: true) to disable check for compilation.children hashes. - New option
useCompilationHash
(default: true) to disable check for compilation hash.
I currently have no time to try it but i think the above two logics are obsolet because we got the function _fileIgnoredOrNotEmitted
which is already checking if a file is emitted but to ensure all installations are still working we should add it as optional option first.
For your example maybe its just enough to disable the compilationHash option because your files will exists in compilation.children.
@statianzo or am i wrong or forgot something?