webpack5解决 Invalid options object. Dev Server has been initialized using an options object that...

将contentBase改为static即可

devServer: {
        static: './dist'), // 开发服务器启动路径
        open: true
    } 

同时注意package.json中加上–mode xxxx

    "dev": "webpack-dev-server --mode development",
    "build": "webpack --mode development"
  }

你可能感兴趣的:(前端)