The issue seems to be related to the base URL of the application. When accessing the application via the IP address, the base URL is set to /fms/public, but when accessing it locally, the base URL is just /. This causes the paths to be incorrect when accessing the build files.
To fix this, you can set the base URL dynamically based on the current environment. In your Laravel configuration file, you can add the following code:
// config/app.php
return [
// ...
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', null),
// ...
];
Then, in your Vue app, you can set the base URL dynamically based on the Laravel configuration:
// resources/js/app.js
import { createApp } from 'vue';
import App from './App.vue';
const app = createApp(App);
const baseUrl = document.querySelector('meta[name="base-url"]').getAttribute('content');
app.config.globalProperties.$baseUrl = baseUrl;
app.mount('#app');
Finally, in your HTML layout file, you can add a meta tag to set the base URL:
<!-- resources/views/layouts/app.blade.php -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="base-url" content="{{ url('/') }}">
<title>My App</title>
</head>
<body>
<div id="app"></div>
<script src="{{ mix('js/app.js') }}"></script>
</body>
</html>
This should set the base URL correctly and allow the build files to be loaded correctly.