livewire: 404 for livewire.js when not using php artisan serve

Describe the bug I have the counter livewire example app being served from the htdocs folder of my local xampp. When I access the app I get a 404 for the livewire.js file. However when I use use php artisan serve to serve the app and access it the livewire.js is served correctly

To Reproduce Steps to reproduce the behavior:

  1. Create a new laravel app.
  2. Install livewire in it
  3. Serve or run it with a normal web server instead of php artisan serve
  4. See error in the network tabs of the browser

Expected behavior Expected the path to the livewire.js file to be resolved correctly no matter where itsa being served from

Screenshots

Error when served from localhost with a webserver

liveiwire-2

Loaded correctly when served with php artisan serve

liveiwire-3

Desktop (please complete the following information):

  • Browser - chrome

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@RafaTorices try run: php artisan livewire:publish then open config/livewire.php change 'asset_url' => null to 'asset_url' => 'http://localhost/laravel8/public'

okay, let’s try once again with follow this steps

  1. install laravel with jetstream livewire normally (until step php artisan migrate)
  2. register 1 new user through http://localhost/laravel8/public/register
  3. run php artisan vendor:publish --tag=jetstream-views
  4. run php artisan livewire:publish --assets
  5. run php artisan livewire:publish
  6. open config/livewire.php change 'asset_url' => null to 'asset_url' => 'http://localhost/laravel8/public'

I to do that and everything running well without artisan serve

Just notice when publishing vendor files it works:

php artisan vendor:publish --tag=livewire:assets

According docs this is not mandatory.

@calebporzio … sweet…will test and feedback…thanks