[Answered ]-Dev Server has been initialized using an options object that does not match the API schema. โ€“ options has an unknown property 'public'

1๐Ÿ‘

As the error states, public is not a valid property where you have config.devServer.public('http://0.0.0.0:8080'). It is a property from webpack-dev-server v3 but based on your error message and the list of available property names, you are clearly on webpack-dev-server v4.

Ask yourself though: do you need to specify what is normally the default devserver address, 0.0.0.0:8080 (localhost:8080)? Try just removing the property and test if your app works. Usually such a property is only needed for proxy or websocket addresses. The migration guide from v3 to v4 even says:

public, sockHost, sockPath, and sockPort options were removed in favor client.webSocketURL option:

v3:

module.exports = {
  devServer: {
    public: "ws://localhost:8080",
  },
};
module.exports = {
  devServer: {
    sockHost: "0.0.0.0",
    sockPath: "/ws",
    sockPort: 8080,
  },
};

v4:

module.exports = {
  devServer: {
    client: {
      // Can be `string`:
      //
      // To get protocol/hostname/port from browser
      // webSocketURL: 'auto://0.0.0.0:0/ws'
      webSocketURL: {
        hostname: "0.0.0.0",
        pathname: "/ws",
        port: 8080,
      },
    },
  },
};
๐Ÿ‘คyoduh

Leave a comment