Watching "static" HTML/PHP files with Webpack
BEFORE YOU SUBMIT please read the following:
- [ ] I'm submitting a bug report
- [ ] I'm submitting a feature request
- [x] I'm submitting a support request
webpack version: 3.11.0
sw-precache-webpack-plugin version: 0.11.5
Please tell us about your environment: Linux - Ubuntu 16.04
Browser: [Phantom XX | Chrome XX | Firefox XX | IE XX | Safari XX | Other XX]
Chrome 65
Current behavior:
I am wondering how to properly deal with this. Currently I am caching some Laravel PHP files like so:
dynamicUrlToDependencies: {
'/': ['resources/views/home.blade.php']
}
This work but because the files are not part of the Webpack pipeline files like these are not being watched and a new service-worker.js file is never being generated once I edit files like home.blade.php.
It generates a hash without any problem but once I change this file I need to re-run my entire Webpack process to generate a new service-worker.js file which contains an updated hash.
I am not sure how a new service-worker.js file is currently being generated when Webpack notices a change in css or js file but the same would need to happen when html files like these have changed. Even if I could get Webpack to notice changes in these files I am unsure how to even call the plugin to re-generated the file.
Is there a good way to deal with this? Hopefully I have my question clear, otherwise ask me anything.
After review how to create a Webpack plugin I see this plugin uses the hook:
compiler.plugin('after-emit', afterEmit);
The Webpack documentation states this runs:
After emitting assets to output dir
So I guess it will be pretty difficult to watch changes in static files with the way this plugin is currently set up?
the plugin is made more toward production, so watching files during dev is out of the scope.