webpack - 如何为 Vue CLI 3 项目设置虚拟主机
问题描述
我希望能够从而http://pbdev
不是访问我的 Vue 项目localhost:8080
。我熟悉在 Apache 中创建虚拟主机,但我不清楚如何使用 Vue CLI 3 项目来做到这一点。
到目前为止,我已将其放入/etc/hosts
:
# Vue Hosts
127.0.0.1:8080 pbdev
我把它放进去vue.config.js
:
module.exports = {
lintOnSave: false,
devServer: {
host: 'pbdev',
port: 8080,
https: false
}
}
我收到以下错误:
INFO Starting development server...
10% building modules 1/1 modules 0 activeevents.js:167
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND pbdev
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)
Emitted 'error' event at:
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1505:12)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:17)
有谁知道我做错了什么?
解决方案
在里面:8080
是/etc/hosts
问题,只是做127.0.0.1 pbdev
祝你快乐!
推荐阅读
- scala - 如何在 CircleCI 上添加 SBT 插件解析器?
- r - 找出一个唯一值在多个文件中出现的次数以及这些文件的数量
- firebase - Flutter:如何将多个 Firebase 项目添加到我的 Flutter 项目中
- angular - 何时不使用服务器端渲染 - Angular Universal
- c# - 如何从服务器返回json字符串
- jquery - 标题标签后的内容不可见
- django - 如果日期字段大于其他重复项,如何排除具有相同字段的项目?
- java - 我怎样才能发现在后台加载 JavaFX 图像失败?
- sql - 使用 MS Access 的 SQL 查询中存储在表列中的通配符
- r - 数据框列表 :: 如何编辑特定数据框中的特定列?