-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25204fd
commit 9f7e62c
Showing
5 changed files
with
60 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"API_URL": "http://localhost:5000" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,15 @@ | ||
import { fileURLToPath, URL } from 'node:url'; | ||
import os from 'os'; | ||
|
||
import { defineConfig } from 'vite'; | ||
import vue from '@vitejs/plugin-vue'; | ||
import vueDevTools from 'vite-plugin-vue-devtools'; | ||
|
||
function getLocalIP() { | ||
const networkInterfaces = os.networkInterfaces(); | ||
|
||
for (const interfaceName in networkInterfaces) { | ||
const interfaceInfo = networkInterfaces[interfaceName]; | ||
|
||
if (!interfaceInfo) { | ||
continue; | ||
} | ||
|
||
for (const info of interfaceInfo) { | ||
if (info.family === 'IPv4' && !info.internal) { | ||
return info.address; | ||
} | ||
} | ||
} | ||
|
||
return 'localhost'; // Fallback to localhost if no external IP is found | ||
} | ||
|
||
// https://vite.dev/config/ | ||
export default defineConfig({ | ||
plugins: [ | ||
vue(), | ||
vueDevTools(), | ||
], | ||
resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, | ||
server: { | ||
proxy: { '/api': 'http://localhost:5000' }, | ||
host: getLocalIP() | ||
}, | ||
server: { proxy: { '/api': 'http://localhost:5000' } }, | ||
}); |