🦁

webpack-dev-serverでcontentBaseがエラーを吐いた

2023/06/02に公開
devServer: {
	    contentBase: './???'
}
Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'contentBase'. These properties are valid:
   object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }

でエラーを吐いた
調べたところ versionが変わった関係で書き方が変わっていました。
[https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md]

devServer: {
      static:{
        directory:'./???'
      }
    },

これでエラー解決です

Discussion