Skip to content

Commit

Permalink
Merge pull request #4 from pbs/main
Browse files Browse the repository at this point in the history
renzo's fix for webpack config
  • Loading branch information
mirukie authored Aug 8, 2024
2 parents de53a6d + c4c9d02 commit 9af2f9a
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,29 @@ module.exports = (env) => {
new ESLintPlugin()
];

// Get running network information
let networkInfo = os.networkInterfaces();
let ipAddress;
if (!isProduction) {
// Get running network information
let networkInfo = os.networkInterfaces();
let ipAddress;

// Depending on operating system the network interface will be named differntly. Check if each exists to find the correct syntax
if (networkInfo.en0){
ipAddress = networkInfo.en0[1].address;
} else if (networkInfo.en7) {
ipAddress = networkInfo.en7[1].address;
} else if (networkInfo['Wi-Fi']){
ipAddress = networkInfo['Wi-Fi'][1].address;
} else if (networkInfo['Ethernet']){
ipAddress = networkInfo['Ethernet'][1].address;
} else if (networkInfo.eth0){
ipAddress = networkInfo.eth0[1].address;
}

if (ipAddress) {
console.log('\x1b[36m%s\x1b[0m', "NETWORK HOST: http://" + ipAddress + ":8080")
} else {
console.log('\x1b[36m%s\x1b[0m', "Unable to find network address");
// Depending on operating system the network interface will be named differntly. Check if each exists to find the correct syntax
if (networkInfo.en0){
ipAddress = networkInfo.en0[1].address;
} else if (networkInfo.en7) {
ipAddress = networkInfo.en7[1].address;
} else if (networkInfo['Wi-Fi']){
ipAddress = networkInfo['Wi-Fi'][1].address;
} else if (networkInfo['Ethernet']){
ipAddress = networkInfo['Ethernet'][1].address;
} else if (networkInfo.eth0){
ipAddress = networkInfo.eth0[1].address;
}

if (ipAddress) {
console.log('\x1b[36m%s\x1b[0m', "NETWORK HOST: http://" + ipAddress + ":8080")
} else {
console.log('\x1b[36m%s\x1b[0m', "Unable to find network address");
}
}

return {
Expand Down

0 comments on commit 9af2f9a

Please sign in to comment.