You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
388 B

4 years ago
  1. 'use strict';
  2. function runBonjour({ port }) {
  3. const bonjour = require('bonjour')();
  4. const os = require('os');
  5. bonjour.publish({
  6. name: `Webpack Dev Server ${os.hostname()}:${port}`,
  7. port,
  8. type: 'http',
  9. subtypes: ['webpack'],
  10. });
  11. process.on('exit', () => {
  12. bonjour.unpublishAll(() => {
  13. bonjour.destroy();
  14. });
  15. });
  16. }
  17. module.exports = runBonjour;