webpack-cli: serve command suddenly stopped working (due to recent version bump?)

Describe the bug

I assume that after bumping @webpack-cli/serve to 1.5.2 something has been broken, as after adding the following in my package.json, webpack serves correctly as expected.

"resolutions": {
    "@webpack-cli/serve": "1.5.1"
  }

What is the current behavior?

Webpack fails to build on serve.

- configuration has an unknown property '_assetEmittingPreviousFiles'. These properties are valid:
- { bonjour?, client?, compress?, devMiddleware?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, public?, setupExitSignals?, static?, transportMode?, watchFiles? }

To Reproduce

Steps to reproduce the behavior:

I have just done a clean install of one of my projects using the serve command. Suddenly, it stopped working. I have seen that both packages webpack-cli and @webpack-cli/serve have been published recently (14h ago at time of writing this issue).

Expected behavior

Serve should work as expected

Screenshots

Please paste the results of webpack-cli info here, and mention other relevant information

  System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 1.68 GB / 16.00 GB
  Binaries:
    Node: 12.22.3 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.13 - /usr/local/bin/npm
  Browsers:
    Chrome: 92.0.4515.131
    Edge: 92.0.902.73
    Firefox: 89.0
    Safari: 14.0.2
  Monorepos:
    Yarn Workspaces: 1.22.10

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 23 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I just had this issue but it was due to webpack-cli not being updated to the latest version, this fixed it

Hi Everyone, Having some issues too.

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?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }

Using: webpack@5.90.3 / webpack-cli@5.1.4 / webpack-dev-server@5.0.2

Current code:

The issue has been fixed - the key part was the one mentioned by @alexander-akait

Sorry, your infromation is not helpful, I think you pass the compiler to dev server constructor firstly, but in v5, you need to pass options as a first argument https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L257 and the compiler as second

Please update 4.0.0-beta.3 to 4.0.0-rc.0 (today we will do rc.1 with more fixes), it is expected, because 4.0.0-beta.3 is not stable

I just ran into the _assetEmittingPreviousFiles error as well.

I needed to update webpack-cli to 5.1.4.

@dannkkie Please read the migration guide, we have breaking changes between v4 and v5 https://github.com/webpack/webpack-dev-server/blob/master/migration-v5.md

Update i downgraded webpack-dev-server to 4.15.1 and i dont see the error again

Does not work for me, even older previously working builds from today and yesterday are not working anymore which is very weird.

Thanks a lot @alexander-akait ! It worked 😊