Livewire routes issue for latest sage/aorn

I have found since December last year, that setting up a WP site using Trellis, Bedrock, Sage and Acorn, the Livewire instructions no longer appear to work.

I am repeatedly met with the following error:

 Symfony\Component\Routing\Exception\RouteNotFoundException
Route [livewire.update] not defined.

I am using a Mac OS (Sequoia 15.3) with Herd/Valet as my local environment.

I have made a full repo here showing the setup

Please advise? As far as I can tell it appears to be an nginx issue, but it’s difficult as the documentation pages appears to be out of sync with where Sage is currently at (ie Vite now instead of Budjs etc).

Livewire is essential to the projects I am in the middle of, so if it can’t be resolved, I’ll need to fully switch away from Roots sadly.

Thanks!

Here’s how I got it working after a day of trial and error:

added withRouting to App config in functions.php

Application::configure()
    ->withProviders([
        App\Providers\ThemeServiceProvider::class,
    ])
    ->withRouting(
        wordpress: true
    )
    ->boot();

This, however, did not won’t work with subdirectory Multisite setup like it did with Acorn v4.3.2 out of the box. I had to add an additional block to Nginx config to prevent 404 on subsites.

location ~ ^(?:/[^/]+)?/livewire/livewire\.js$ {
  # Rules for livewire.js
}
1 Like

Thank you so much! That “withRouting” fixed it! You saved my week!

I was getting ready to setup a separate app just to run the livewire components via api.