fly
aijinhui
2023-12-18 4c7e2078a1439ad6fb42f8854f5f8ac1e6859cbc
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;