webpack/webpack-cli

serve command suddenly stopped working (due to recent version bump?)

vanbasten17 opened this issue ยท 23 comments

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

Remove @webpack-cli/serve, you should not use this directly

The problem can be due invalid usage of API, we have a lot of integration test, example webpack/webpack-dev-server#3649 and no problems with webpack v4 and webpack v5

And please always clarify steps:

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

Which projects? How you run dev server? What are versions?

The project I'm trying to run is a monorepo project, that has all the webpack configuration in one of their dependencies node_modules/@botonic/dx/botonic-app-config/ (as you can see here, in the root's package json of this we don't have @webpack-cli/serve specified, so we are not using it directly. To try it, run the following command:
yarn create botonic-app test (after installation, cd into the project and try to run yarn serve).
The versions that appear when executing webpack are the following ones:

node_modules/.bin/webpack --version
webpack 5.50.0
webpack-cli 4.8.0
webpack-dev-server 4.0.0-beta.3

It should not work.
Then try to put the following in test/package.json

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

and works as expected. So I assume that it has to be related in some way with 1.5.2 version of the package.

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

Thanks a lot @alexander-akait ! It worked ๐Ÿ˜Š

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

Sorry information is not enough to help you

@chillyistkult @alexander-akait Did you ever find a fix by any chance? I'm facing the same issue when upgrading to webpack 5.0.1.

I was previously on webpack 4.0.0

    OS: Linux 6.1 Amazon Linux 2023
    CPU: (2) x64 Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
    Memory: 3.21 GB / 7.63 GB
  Binaries:
    Node: 18.12.1 - /usr/bin/node
    npm: 8.19.2 - /usr/bin/npm
  Browsers:
    Chrome: 120.0.6099.224
  Packages:
    awesome-typescript-loader: ^5.2.1 => 5.2.1 
    babel-loader: ^8.2.2 => 8.3.0 
    css-loader: ^6.7.1 => 6.10.0 
    dotenv-webpack: ^7.0.1 => 7.1.1 
    loader-utils: ^3.2.1 => 3.2.1 
    postcss-loader: ^7.0.1 => 7.3.4 
    speed-measure-webpack-plugin: ^1.5.0 => 1.5.0 
    string-replace-loader: ^3.1.0 => 3.1.0 
    style-loader: ^3.3.1 => 3.3.4 
    ts-loader: ^9.4.1 => 9.5.1 
    tsconfig-paths-webpack-plugin: ^3.5.1 => 3.5.2 
    webpack: ^5.90.2 => 5.90.2 
    webpack-cli: ^5.1.4 => 5.1.4 
    webpack-dev-server: ^5.0.1 => 5.0.1 
    webpack-merge: ^5.8.0 => 5.10.0```
    
 

This is the log I am getting: 
    
` ValidationError: 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? }`
  

Please update deps to the latest versions, thank you

Using webpack@5.90.3 webpack-dev-server@5.0.2 and all dependencies updated but i still get this '_assetEmittingPreviousFiles' issue

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

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

Even though I don't use webpack-cli in my code, I installed it but still had same issue

@dannkkie Hello, can you provide a reproducible test repo?

@dannkkie Hello, can you provide a reproducible test repo?

This is the specific error message I get
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'.

hm, sounds like you have a mistake with webpack node api

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

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

So i just tried that with the latest version again and I get 'onBeforeSetupMiddleware'

@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

@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

This helped...Thanks ๐Ÿ˜€

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

I just ran into the _assetEmittingPreviousFiles error as well.

I needed to update webpack-cli to 5.1.4.