-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
./bin/webpack-dev-server
doesn't work with rails 6.1.4.1
#43062
Comments
I have similar issue with Webpacker behavior
Webpacker configurationIn
Package.json
System configurationRails version: 6.1.4.1 |
Which NodeJS version are you using? |
Same pb. Mine is v14.15.1. Just run |
Same here. This got me back up and running again. diff --git a/package.json b/package.json
index 23e15fa..3f7788d 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,6 @@
},
"version": "0.1.0",
"devDependencies": {
- "webpack-dev-server": "^4.0.0"
+ "webpack-dev-server": "3.11.2"
}
} |
@toddsiegel tried your solution but encountered this error:
|
These are all the relevant webpack(er) versions I am running on a new Rails 6.1.4.1 app. Hope this helps. "dependencies": {
...
"@rails/webpacker": "5.4.2",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12"
},
"devDependencies": {
"webpack-dev-server": "3.11.2"
} |
This looks like it's a webpack (likely a webpack-cli) issue... I wonder if this is relevant webpack/webpack-cli#2272 (comment)? I can also confirm that creating a new rails app with node --version 15.0.1 I also get the same issue as OP. @AhmedNadar your issue is slightly different, looks like you have webpack cli working but have a config issue. Looks like watch_options should be changed to static, see the setup docs here https://webpack.js.org/configuration/dev-server/
|
I've upgraded one of my projects from 5 to 6 and stumbled on most of the errors listed here, so... @nukerr I understand you are creating a new project, but could you please follow these steps from the upgrade guide? I think they might finish installing the files/configurations that are currently missing.
@AhmedNadar Webpacker 6 relies on a new version of webpack, which has some incompatible configurations with the previous one. Did you just upgrade from Webpacker 5 and kept your old configuration files that were in @johnpitchko This looks like you downgraded the package but are still using the version 4 binary. I've had this problem before and it usually takes some fiddling telling yarn to remove the dev server and then install it back to fix:
|
webpack-dev-server is not compatible with Webpacker 5.x. You'll need Webpacker 6.0 for compatibility. Otherwise go back to webpacker-dev-server 3.x. |
would be great to mention this in an upgrade guide. And what is the replacement for the webpack-dev-server? Thanks! |
You can watch this article that explain how fix it: https://tundaapo.medium.com/the-web-as-a-means-of-communication-starting-with-rails-c10aa28b4fc2 |
@dhh If I were to attempt to put together a non-breaking patch that would allow v5 of |
Why webpack-cli as a dependency? This is a devDependencies, no? |
There was an error when trying to run the webpack dev server after a fresh install. This is because webpack-dev-server 4.x is no longer compatible with webpacker 5.x. rails/rails#43062 (comment) webpacker 6 doesn't have a stable release yet so it is not an option to upgrade, we need to downgrade webpack-dev-server
Co-authored-by: Carolyn Cole <carolyncole@users.noreply.github.com> Co-authored-by: Francis Kayiwa <kayiwa@users.noreply.github.com>
Fixing webpack-dev-server in response to rails/rails#43062
Steps to reproduce
rails new <project name> -d=postgresql
../bin/webpack-dev-server
.Expected behavior
Webpack dev server running correctly without error.
Actual behavior
./bin/webpack-dev-server
output:System configuration
Rails version: 6.1.4.1
Ruby version: 3.0.2
The text was updated successfully, but these errors were encountered: