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

V6 upgrade cli error - Invalid options for dev server #526

Open
devsheva opened this issue Nov 21, 2024 · 2 comments
Open

V6 upgrade cli error - Invalid options for dev server #526

devsheva opened this issue Nov 21, 2024 · 2 comments
Labels

Comments

@devsheva
Copy link

Notice: A bug is a crash or incorrect behavior. If you have a debugging or troubleshooting question, please open a discussion on the Discussions Tab. Otherwise, remove this line and fill out the following sections.

Expected behavior:

Following the V6 upgrade guide to migrate from webpacker 5.x to 6.0.0rc should work fine when compiling assets and running dev-server

Actual behavior:

Trying to even launch the dev server command manually leads to this error.

npx webpack serve

[webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
 - options has an unknown property '_assetEmittingPreviousFiles'. These properties are valid:
   object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, ipc?, liveReload?, onListening?, open?, port?, proxy?, server?, app?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }

Small, reproducible repo:

cannot easily provide unfortunately

Setup environment:

  • Ruby version: 2.7.4
  • Rails version: 6.1
  • Webpacker version: 6.0.0rc6
  • webpack: 5.96.1
  • webpack-cli: 4.10.0
  • webpack-dev-server 5.1.0
@devsheva devsheva added the bug label Nov 21, 2024
@devsheva devsheva changed the title V6 upgrade cli error - Invalid options for de server V6 upgrade cli error - Invalid options for dev server Nov 21, 2024
@devsheva
Copy link
Author

I think i found the issue, webpack-cli v4 is not compatible with webpack-dev-server 5, and this is caused by this line which is causing the latest major install for dev server npm.

https://github.com/rails/webpacker/blob/a715e055d937748c7cfd34b0450295348ca13ee6/lib/install/template.rb#L85

@devsheva
Copy link
Author

another problem i have now is that CSS is not getting loaded when using hmr

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

No branches or pull requests

1 participant