Skip to content

[Feature] 增加 IP 显示提 #6

@Roamin

Description

@Roamin

项目启动后,增加 IP 地址提示

真机调试的时候,往往需要手机访问,而 localhost 是不能直接被访问,故显示 IP 地址会更方便友好一些

  • 依赖
npm install ip --save-dev
  • /build/webpack.dev.conf.js
const ip = require('ip')

// ...
compilationSuccessInfo: {
    messages: [
        `Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`, 
        `Your application is running here: http://${ip.address()}:${port}`
    ]
},
  • 效果
    image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions