鍍金池/ 問答/HTML/ node項(xiàng)目啟動(dòng)后如何通過不同的host主機(jī)名訪問?

node項(xiàng)目啟動(dòng)后如何通過不同的host主機(jī)名訪問?

啟動(dòng)Node+Vue項(xiàng)目后,可以通過localhost加端口號(hào)訪問,但不能通過127.0.0.1本機(jī)IP訪問,目前的配置如下:

module.exports = {
  dev: {

    // Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {},

    // Various Dev Server settings
    host: 'localhost', // can be overwritten by process.env.HOST
    port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    autoOpenBrowser: false,
    errorOverlay: true,
    notifyOnErrors: true,
    poll: false,
  }
}

我想讓上面代碼中的localhost同時(shí)匹配127.0.0.1和本機(jī)IP,但似乎host的value不支持?jǐn)?shù)組和逗號(hào)分隔,網(wǎng)上查了下也沒找到相關(guān)文檔如何配置多個(gè)host,請(qǐng)問各位大佬,應(yīng)該如何配置呢?每次只能使用一個(gè)主機(jī)名嗎?

localhost:8080      ?
127.0.0.1:8080      ?
192.168.0.100:8080  ?

回答
編輯回答