Class constructor ServeCommand cannot be invoked without ‘new‘

webpack serve

[webpack-cli] Promise rejection: TypeError: Class constructor ServeCommand cannot be invoked without 'new'
[webpack-cli] TypeError: Class constructor ServeCommand cannot be invoked without 'new'
    at run (F:\LearnCode\Front-end\MicroFrontend\products\node_modules\webpack-cli\lib\utils\resolve-command.js:33:12)
    at Command.<anonymous> (F:\LearnCode\Front-end\MicroFrontend\products\node_modules\webpack-cli\lib\utils\arg-parser
.js:32:58)
    at Command.listener [as _actionHandler] (F:\LearnCode\Front-end\MicroFrontend\products\node_modules\webpack-cli\nod
e_modules\commander\index.js:426:31)
    at Command._parseCommand (F:\LearnCode\Front-end\MicroFrontend\products\node_modules\webpack-cli\node_modules\comma
nder\index.js:1002:14)
    at Command._dispatchSubcommand (F:\LearnCode\Front-end\MicroFrontend\products\node_modules\webpack-cli\node_modules
\commander\index.js:953:18)
    at Command._parseCommand (F:\LearnCode\Front-end\MicroFrontend\products\node_modules\webpack-cli\node_modules\comma
nder\index.js:970:12)
    at Command.parse (F:\LearnCode\Front-end\MicroFrontend\products\node_modules\webpack-cli\node_modules\commander\ind
ex.js:801:10)
    at argParser (F:\LearnCode\Front-end\MicroFrontend\products\node_modules\webpack-cli\lib\utils\arg-parser.js:145:27
)
    at parseArgs (F:\LearnCode\Front-end\MicroFrontend\products\node_modules\webpack-cli\lib\bootstrap.js:18:29)
    at runcLI (F:\LearnCode\Front-end\MicroFrontend\products\node_modules\webpack-cli\lib\bootstrap.js:24:24)

重新安装 webpack-cli,不指定版本,直接下载最新版。可能是版本过低导致的。

相关文章

一准备工作umi为react的一个封装比较nice的脚手架。优点当然...
webpack在引入两个依赖的包时,可能需要使用shimming,意思是...
  Happypack (plugin)多线程使用loader编译文件treeshaki...
一目录结构├──build//构建相关├──config//配置相关├─...
接着第一节的demo现在我们尝试整合一些其他资源,比如图像,...
webpack的打包原理识别入口文件通过逐层识别模块依赖(Common...