Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Webpacker 5.4.3 Issue -- Webpacker doing compilation instead of Webpack Dev Server #3230

Closed
shaneajeffery opened this issue Nov 19, 2021 · 2 comments

Comments

@shaneajeffery
Copy link

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.

@shaneajeffery shaneajeffery changed the title Upgrade to Webpacker 5.4.3 Issue -- Com Upgrade to Webpacker 5.4.3 Issue -- Webpacker doing compilation instead of Webpack Dev Server Nov 19, 2021
@justin808
Copy link
Contributor

@shaneajeffery

  1. You can find a working solution of this https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh.
  2. 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.

@shaneajeffery
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants