host

The host configuration is similar to Rspack's devServer host configuration, used to specify the hostname or IP address to listen on.

  • 类型string
  • 默认值: 0.0.0.0

Host can be an IP address or hostname. After the local server starts, the specified IP or hostname can access the project via network. When host is the default value (0.0.0.0), all hosts on the network can access the project.

During project build, the host value will be passed to Rspack's devServer host configuration.

示例

emp-config.js
export default defineConfig(store => {
  ...
  return {
    ...
    server: {
      host: '127.0.0.1',
      ...
    },
    ...
  }
})

This configuration example means the project only allows access from localhost (127.0.0.1).

ON THIS PAGE