webpack 使用webpack-dev-server 报错

我的配置文件为:

const path = require('path');

module.exports = {
  mode: 'development',
  entry: './main.js',
  output: {
    path: path.resolve(__dirname, './dist'),
    filename: 'bundle.js',
  },
};

异常信息:

✖ 「wds」: Invalid configuration object. Webpack has been initialised using a configuration object that does not match theAPI schema.
 - configuration has an unknown property 'mode'. These properties are valid:
   object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
   For typos: please correct them.
   For loader options: webpack 2 no longer allows custom properties in configuration.
     Loaders should be
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
webpack-dev-server --progress --config是一个命令,用于启动webpack开发服务器并显示进度。根据引用和引用的信息,出现报错的原因可能是webpack-dev-server的版本不兼容。解决这个问题的方法有两种: 1. 方法一:删除node_modules目录,然后重新安装依赖包npm install -S。这个方法比较费时间,但可以确保安装的是最新版本的webpack-dev-server。 2. 方法二:先卸载当前的webpack-dev-server,通过指令npm uninstall webpack-dev-server,然后再使用指令npm install webpack-dev-server@2.9.7(或者其他合适的低版本)来安装特定版本的webpack-dev-server。这个方法可以解决版本不兼容的问题。 综上所述,你可以选择其中一种方法来解决报错问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [webpack-dev-server --inline --progress --config build/webpack.dev.conf.js 解决办法](https://blog.csdn.net/sinat_35441683/article/details/121692857)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [npm报错`webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`](https://blog.csdn.net/GongWei_/article/details/107907911)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值