The other day I downloaded my laravel website from my server to make some updates. When I ran the test environment locally, the urls of my newly added Script files were not “localhost”. As a result, the script files cannot be found. Why is the file path of my scripts an internet address even though I run my project locally?
Developer tools / Network tab
webpack.mix.js;
mix.js('resources/js/homepage2.js', 'public/js').version();
in Blade file;
<script src="{{ mix('js/homepage2.js') }}"></script>
❌Not working because only redirecting to my website url.
<script src="{{ asset('js/homepage2.js') }}"></script>
✔️Working fine. Url is http://127.0.0.1:8000/js/homepage2.js. It’s as it should be.
I haven’t figured out how to do research for 3 days. Thanks in advance for your help.
I tried “npm run dev” or “npm run production” and it didn’t make any difference.
I changed the APP_URL part inside the .env file and it didn’t make any difference.
ismail is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.