Laravel-mix: unknown property 'dev' using "run hot"

Created on 7 May 2021  Â·  7Comments  Â·  Source: JeffreyWay/laravel-mix

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "hot": "mix watch --hot"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "laravel-mix": "^6.0.18"
  },
  "dependencies": {
    "vue": "^2.6.12"
  }
}

Then do npm run hot and I get this:

Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.

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

There's no webpack config and webpack.mix is emtpy.

Most helpful comment

I temporarily fixed it by overriding the Webpack configuration generated by Laravel Mix:

mix.override(config => {
    // Apply a workaround caused by Laravel Mix using the `[email protected]`:
    // https://github.com/webpack/webpack-dev-server/releases/tag/v4.0.0-beta.3.
    // Basically the `dev` property has been deprecated in favor of `devMiddleware`.
    if (config.devServer) {
        config.devServer.devMiddleware = config.devServer.dev;
        delete config.devServer.dev;
    }
});

All 7 comments

I've narrowed this down to the webpack-dev-server package version 4.0.0-beta.3.

Same issue.
Can be reproduced with a fresh laravel install followed by npm install

I temporarily fixed it by overriding the Webpack configuration generated by Laravel Mix:

mix.override(config => {
    // Apply a workaround caused by Laravel Mix using the `[email protected]`:
    // https://github.com/webpack/webpack-dev-server/releases/tag/v4.0.0-beta.3.
    // Basically the `dev` property has been deprecated in favor of `devMiddleware`.
    if (config.devServer) {
        config.devServer.devMiddleware = config.devServer.dev;
        delete config.devServer.dev;
    }
});

I temporarily fixed it by overriding the Webpack configuration generated by Laravel Mix:

mix.override(config => {
    // Apply a workaround caused by Laravel Mix using the `[email protected]`:
    // https://github.com/webpack/webpack-dev-server/releases/tag/v4.0.0-beta.3.
    // Basically the `dev` property has been deprecated in favor of `devMiddleware`.
    if (config.devServer) {
        config.devServer.devMiddleware = config.devServer.dev;
        delete config.devServer.dev;
    }
});

Great !! thanks :-)

I temporarily fixed it by overriding the Webpack configuration generated by Laravel Mix:

mix.override(config => {
    // Apply a workaround caused by Laravel Mix using the `[email protected]`:
    // https://github.com/webpack/webpack-dev-server/releases/tag/v4.0.0-beta.3.
    // Basically the `dev` property has been deprecated in favor of `devMiddleware`.
    if (config.devServer) {
        config.devServer.devMiddleware = config.devServer.dev;
        delete config.devServer.dev;
    }
});

Omg i wanna kiss you.

Spent 3+ hours on this.. came here to report the bug and noticed the first issue was my issue.

You have no idea.. my sanity thanks you!

😱😱😱

We're gonna have to push out a fix for this and lock the version to a specific beta release (… we're on a beta b/c of webpack 5 support). I didn't realize that ^ would upgrade through different beta versions, apologies. I'll see if I can take care of this today. (a PR would be welcome too!)

Plan:

  1. Upgrade to latest webpack-dev-server release — pinned to exactly a given version.
  2. Fix the config
  3. Verify tests pass
  4. Release new version

We've tagged 6.0.19. I opted to pin to beta 2 instead of upgrading to beta 3 as I don't have the time at the moment to properly investigate. This should be good to go now though.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Bomavi picture Bomavi  Â·  3Comments

jpriceonline picture jpriceonline  Â·  3Comments

nezaboravi picture nezaboravi  Â·  3Comments

mstralka picture mstralka  Â·  3Comments

hasnatbabur picture hasnatbabur  Â·  3Comments