1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/webpack-dev-server/lib/utils/runBonjour.js

22 lines
388 B
JavaScript
Raw Normal View History

2023-12-18 13:12:25 +08:00
'use strict';
function runBonjour({ port }) {
const bonjour = require('bonjour')();
2024-01-16 21:26:16 +08:00
const os = require('os');
2023-12-18 13:12:25 +08:00
bonjour.publish({
2024-01-16 21:26:16 +08:00
name: `Webpack Dev Server ${os.hostname()}:${port}`,
2023-12-18 13:12:25 +08:00
port,
type: 'http',
subtypes: ['webpack'],
});
process.on('exit', () => {
bonjour.unpublishAll(() => {
bonjour.destroy();
});
});
}
module.exports = runBonjour;