Closed dircm closed 8 months ago
I have found the issue:
Because the local development environment is running with APP_DEBUG=true
this then configures Livewire to return a non-minimised version of the javascript asset.
See vendor/livewire/livewire/src/Mechanisms/FrontendAssets/FrontendAssets.php
If debug is true, then Livewire will return /livewire/livewire.js
, but wire-extender.js is requesting /livewire/livewire.min.js
.
Setting debug to false solves this issue.
Could you consider requesting the appropriate javascript depending on the debug config. This is how Livewire does it :
app($this::class)->setScriptRoute(function ($handle) {
return config('app.debug')
? Route::get('/livewire/livewire.js', $handle)
: Route::get('/livewire/livewire.min.js', $handle);
});
Instead of setting APP_DEBUG=false
, you can also manually set data-livewire-asset-uri="/yourwebsite/livewire/livewire.js"
in your HTML file during developement as a workaround.
Instead of setting
APP_DEBUG=false
, you can also manually setdata-livewire-asset-uri="/yourwebsite/livewire/livewire.js"
in your HTML file during developement as a workaround.
Nice idea thanks !
Thanks @clementmas & @dircm! Great to hear it is working. I'll make sure to include this in the documentation 😄
Hi Philo,
I am getting a CORS block on the load attempt of my counter component.
I have followed the steps in your setup from the blog post. Ill post the contents of my cors config below.
I have built the demo component from your blog post and stored in App/Livewire folder.
Questions:
Do I need to create a route to the component ?
How should I provide any folder nesting in the
livewire data-component
declaration i.e. example.counter ...Here is my example hosting page:
Here is the cors.php :
Here is the VerifyCsrfToken.php
And finally here is the result showing the blocked resource :