local-domains
Returns a list of local domains
Install
With npm:
npm install --save-dev local-domains
Examples
const localDomains = ; ;// => [// 'my-cool-site.dev', // 'my-cool-site.meh', // '10.9.8.7.xip.io', // 'my-cool-site.10.9.8.7.xip.io', // 'www.my-cool-site.10.9.8.7.xip.io'// ]
You can also pass an array
of wanted top level domains:
const localDomains = ; ;// => [// 'my-cool-site.localdomain', // 'my-cool-site.thebest', // '10.9.8.7.xip.io'// ]
This works great if you want to set the allowedHosts
in webpack:
const localDomains = ;const hostList = ;…devServer: allowedHosts: hostList compress: true host: '0.0.0.0' hot: true inline: true port: 3000…
or log out the places where you can access your dev server:
const localDomains = ;const hostList = ; hostList;
API
localDomains(name, types)
Returns an array
of domains.
name
Parameter A required string
.
types
Parameter An optional array
of top level domains, with the default of ['dev', 'meh', 'xip', 'name.xip', www.name.xip]
. You can pass ['xip']
or ['xip.io']
and you will get [IP.xip.io]
.