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