Open AndrewRayCode opened 9 years ago
Appears to be because you clear the modules after you process them? https://github.com/skozin/webpack-path-rewriter/blob/master/es6/index.js#L357
No, that's because the loader doesn't get invoked unless you change the file it is rewriting. This is how Webpack currently works. So, when you change some other file, the hashes become different, but webpack-asset-rewriter
has no chance to react to these changes.
Since this module consists of not only loader, but also a plugin, it might be possible to auto-update the target file, but I'm not sure (and have no time to experiment with this now). For now, the best strategy is to disable hashing during development. Eventually, this will be covered by examples in this repo, but until that you can find an example here. That setup supports hashing in production mode, source maps, livereload and hot stylesheets replacement.
Another thing that you may want to enable in development is the includeHash
constructor option. It makes compilation hash dependent on the contents of all files being rewritten, so your app will auto-reload when any of these files (say index.html
) changes. But this should be disabled during production build, as you definitely don't want the hash of your JS bundle to depend on the contents of some file that is not included in that bundle.
hmm - disabling hashing in dev sounds like a good idea. i'll try that and see if the whole thing works with that in place
If you change any source file while webpack is running, the plugin does not rewrite the paths in the built html file. You have to stop and re-run webpack.