当我运行 $ npm run dev
( "dev": "webpack-dev-server"
)时,它会打开localhost:8080 / undefined而不是localhost:8080或至少localhost:8080 / index.html
webpack-config.js devServer部分:
devServer:{
contentBase: path.join(__dirname, 'dist'),
compress: true,
stats: "errors-only",
hot: true,
open: true
如果我删除URL的/ undefined部分,即使更换热模块也能正常工作,所以这不是一个大问题;只是想知道为什么会这样 .
编辑:我在MacOS上
Edit2: npm run dev
时的控制台信息:
Project is running at http://localhost:8080/ webpack output is served from / Content not from webpack is served from /Users/cozarkd/folders/dist webpack: wait until bundle finished: /undefined webpack: Compiled successfully.
泰
1 回答
这似乎是由一个错误引起的:https://github.com/webpack/webpack-dev-server/issues/960
提供快速解决方法(here):