ERROR in multi (webpack)-dev-ser

2020-11-14  本文已影响0人  顽皮的雪狐七七

目录

出错现象

这个错误是我在用vue-cli中使用webpack打包的时候,进行环境分离操作,将webpack.config.js分成三个包

之后启动npm run serve(也就是webpack-dev-server --open)的时候报的错误,package.json文件是下面这样

"scripts": {
    "serve": "webpack-dev-server --open",
    "build": "webpack --config webpack.prod.js"
  },

报错信息

ERROR in Entry module not found: Error: Can't resolve './src' in 'E:\professer\lagou\lagou-homework\fed-e-task-02-02\code\vue-app-base'

ERROR in multi (webpack)-dev-server/client?http://localhost:8080 ./src
Module not found: Error: Can't resolve './src' in 'E:\professer\lagou\lagou-homework\fed-e-task-02-02\code\vue-app-base'
@ multi (webpack)-dev-server/client?http://localhost:8080 ./src main[1]

出错原因

默认的配置入口是webpack.config.js,修改之后webpack-dev-server命令找不到打包入口。

解决方案

指定运行配置文件为webpack.dev.js

"scripts": {
    "serve": "webpack-dev-server --config webpack.dev.js --open",
    "build": "webpack --config webpack.prod.js"
  },

it works~

上一篇 下一篇

猜你喜欢

热点阅读