‘liusuyi’
2023-08-09 161b9318e345c8a0c9cdc133b33a1c759495f323
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;