Upgrade to Webpacker 5.4.3 Issue -- Webpacker doing compilation instead of Webpack Dev Server
shaneajeffery opened this issue · comments
After upgrading to Webpacker 5.4.3 from 5.1.1, we got a bunch of errors when firing any our apps:
ERROR in chunk <appname> [entry]
[name].[chunkhash].js
Cannot use [chunkhash] for chunk in '[name].[chunkhash].js' (use [hash] instead)
One other thing to note is that Webpacker would go and compile all of the assets by default every time you hit an entrypoint instead of letting the webpack-dev-server
handle that part. So, every time we were hitting a new entrypoint in development, Webpacker would go and take 20+ seconds to recompile.
As a part of the upgrade documentation, you are asked to upgrade webpack-dev-server
and @webpack-cli
to the latest versions and that is where the issues lies.
Managed to find: https://stackoverflow.com/questions/69757518/hot-reloading-not-working-rails-6-and-webpacker-5-4-3-gem and the very last comment says that the user downgraded to V3 of both webpack-dev-server
and @webpack-cli
and everything works fine. We did the same thing and had the same success and now webpack-dev-server
does the recompiling and Webpacker doesn't.
There is something going on between the two libraries above and Webpacker 5.4.3.
- You can find a working solution of this https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh.
- I'm got some updates coming to rails/webpacker that will make this seamless.
Related:
@guillaumebriday I recommend that we close this as this will be addressed in v6.
@justin808 Thanks for that Justin. Your solution relies on V6 of Webpacker though, right? We aren't planning to make that upgrade until you all get to a stable version.
For now though, we have it working with just a downgraded version of webpack-dev-server
and @webpack-cli
.