9a396a9c54f082a789ca56cd23e9abbf61901ac250b98634ac7f8e09f04e4223f436dc8ec9ef933d6ce7c8952d04a7c0ab485aa75e86fbf045afe8878e94ce 388 B

123456789101112131415161718192021
  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;