-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Update webpack-dev-server config to work with version 4 #3122
Conversation
|
For local testing I did
gem(
"webpacker",
">= 6.0.0.rc1",
git: "https://github.com/t27duck/webpacker.git",
branch: "webpack-dev-server-update",
)
"@rails/webpacker": "https://github.com/t27duck/webpacker.git#webpack-dev-server-update", Test Execution for ruby ./bin/webpack-dev-server But I can't terminate with Ctrl+C immediately like v3 (it still terminates but takes 10+ seconds) Edit: Looks like the issue is on |
@PikachuEXE - Can't seem to reproduce either. Granted, I was on WSL2 for this branch but it does sound like a |
When Ctrl+C from the dev server pressing Enter key seems to confirm the exit (there's a prompt that's not worded very well). This branch worked well in my testing. Looks like the Ruby tests are fixed on |
`webpack-dev-server` 4 dropped very recently. With it came a very large set of breaking changes regarding the configuration. This updates the dev server configurtation in `development.js` and the default `webpacker.yml` files to work with it. I can at least confirm that using this against a relatively basic Rails app using version 4 with tailwind + turbo works as "expected."
Rebased. Now everything is at least green. |
I have tested this branch with one of my applications, and it appears that some things are still missing. My application uses v4 supports this, but there are changes in the configuration: It seems to me that |
@ledermann - Thanks for pointing that out. I've made some adjustments to the branch so now pretty much anything in |
@t27duck Cool, this works. But there is one more thing: When setting I suggest adding this line to liveReload: !devServer.hmr |
@ledermann - Ok, (If it's not obvious yet, I tend to run webpacker with defaults so any additional knobs and settings that others need please let me know). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after testing the latest change (liveReload
value)
Hey @dhh, it would be great to get this into the v6 release. |
ignored: '**/node_modules/**' | ||
static: | ||
watch: | ||
ignored: '**/node_modules/**' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@t27duck @guillaumebriday Do we need to be on the lookout for changes to the webpacker.yml file as updating this won't be obvious to current installations? Surely not existing beta users. I guess we'll need to double check the upgrade docs one final time before the final release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will open a PR for that to update the upgrade.md
file. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@justin808 what I've been telling people in the various discords and slacks I'm in is to treat it like the "upgrade" from 5 to the betas where you back up the original file, take the new default from the gem, and reapply any custom changes.
devServerConfig.client = devServer.client | ||
} | ||
|
||
devConfig = merge(devConfig, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this override all local (user-side) changes to the config though? We're trying to change this config and our changes keep getting overridden by defaults.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What specific changes are you trying to make that are being overridden? I was under the impression that merge
would more or less take the existing devConfig
which is from the yaml
file and stick on the stats
and devServer
values.
From what I can see, this is a similar pattern to webpacker 4 (old line 21 of this diff)
Just found out
What's supposed to be done when I want both HMR and liveReload disabled? |
@PikachuEXE - Let me know if PR #3154 works for you. |
webpack-dev-server
4 dropped very recently. With it came a very large set of breaking changes regarding the configuration.This updates the dev server configurtation in
development.js
and the defaultwebpacker.yml
files to work with it.I can at least confirm that using this against a relatively basic Rails app using version 4 with tailwind + turbo works as "expected."
The upgrade guide for going from webpacker 5 to 6 pretty much does a redo on the installation (including uninstalling and reinstalling the latest
webpack-dev-server
), so in theory those on the upgrade path would need to review and reimplement any custom config changes anyway for theirwebpacker.yml
file?