@clab In LW3, alpine is included in Livewire; And livewire will only load when a LW component is present. However, to load alpine when a LW component is not present, you will need to load it this way: https://livewire.laravel.com/docs/installation#manually-bundling-livewire-and-alpine
May 29, 2024
3
Level 3
Weird JS not loading if page doesn't contain livewire component (Livewire 3.x)
I recently upgraded my application to Livewire 3.x and all pages with a livewire component load fine. However, pages without a livewire component seem to not load the javascript and give errors in the console such as:
My dependencies:
"require": {
"php": "^8.1.0",
"doctrine/dbal": "^3.0",
"enlightn/enlightn": "^2.1.0",
"google/cloud-error-reporting": "^0.17.0",
"google/cloud-logging": "^1.25",
"guzzlehttp/guzzle": "^7.5.0",
"laravel/framework": "^10.0",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.2",
"livewire/livewire": "^3.0",
"nunomaduro/collision": "^7.0",
"openspout/openspout": "^4",
"power-components/livewire-powergrid": "^5.0",
"spatie/invade": "^2.0",
"spatie/laravel-google-cloud-storage": "^2.1.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.8",
"beyondcode/laravel-er-diagram-generator": "^2.0",
"brianium/paratest": "^7.3",
"fakerphp/faker": "^1.9.2",
"laravel/pint": "^1.13",
"mockery/mockery": "^1.6.7",
"larastan/larastan": "^2.7.0",
"phpunit/phpunit": "^10.0"
},
My vite config:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel(
{
input: [
'resources/sass/app.scss',
'node_modules/@popperjs/core/lib/popper.js',
// 'node_modules/popper.js/dist/popper.js',
'resources/js/app.js',
// 'resources/js/show-hide-password.js',
],
refresh: true,
}
)
],
});
Any help is appreciated and I am willing to provide more information as needed (but don't know what could help in troubleshooting this issue)
Please or to participate in this conversation.