PS C:\demo_webpack> npx webpack-dev-servernpx: installed 363 in 36.802sThe CLI moved into a separate package: webpack-cliPlease install 'webpack-cli' in addition to webpack itself to use the CLI-> When using npm: npm i -D webpack-cli-> When using yarn: yarn add -D webpack-cliCannot find module 'webpack-cli/bin/config-yargs'
2 回答
手掌心
TA贡献1942条经验 获得超3个赞
你是用了webpack4吧
现在使用webpack要同时安装webpack-cli这个包,才可以调用webpack和webpack-dev-server这些命令
npm install webpack webpack-dev-server webpack-cli --save-dev
接下来就可以直接
webpack-dev-server
慕妹3242003
TA贡献1824条经验 获得超6个赞
看样子你在使用ES2015语法写react,那你的loader配置不怎么正确,应该是:
{ test: /\.js$/, exclude:/node_modules/, loader: 'babel-loader'},
{ test: /\.jsx$/, exclude: /node_modules/, loader: 'babel?presets[]=react&presets[]=es2015' }
注意需要安装:npm install --save-dev babel-preset-react babel-preset-es2015
添加回答
举报
0/150
提交
取消