Livewire update route can't be found on new project setup

I’ve just been setting up a new project with Trellis + Sage, just following the documentation so far without adding anything custom, but as soon as I add the simple livewire example in the documentation—specifically, as soon as I add the @livewireScripts directive, my app crashes with the error “Route [livewire.update] not defined.”

To reproduce:

  • trellis-cli 1.13.0 to set up the project
  • enabled: true under SSL key in development/wordpress_sites.yml
  • in the themes directory, composer create-project roots/sage my-theme-name (I ran this command yesterday, and theme.json confirms Sage 11.0.0
  • in the new theme directory, composer require livewire/livewire, which I can see is v3.6.1
  • finally, I’ve just followed the remaining steps on this page exactly, so won’t reprint it all here, but in short that is rendering the @livewireScripts directive in the WP hooks, using wp acorn to create a new Livewire component, and then using it with <livewire:post-list /> on a page (in my case index.blade.php)

After building, I visit the site homepage locally and get Symfony\Component\Routing\Exception\RouteNotFoundException with message Route [livewire.update] not defined.

Running wp acorn route:list confirms that Acorn does have five routes registered:

GET|HEAD livewire/livewire.js
GET|HEAD livewire/livewire.min.js.map
GET|HEAD livewire/preview-file/{filename}
POST           livewire/update
POST           livewire/upload-file

I’ve added nothing beyond this, and am quite stuck figuring out why the route wouldn’t be defined. Any help or pointers much appreciated.

add ->withRouting(wordpress: true) to Application::configure() in functions.php. will get the docs updated.

1 Like