Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

anikett's avatar

Getting error after upgrading to livewire 3 from v2

I have made changes to my livewire application but when using wire:navigate and navigating to pages that have form and submitting form. I'm getting error

"TypeError: window.livewireScriptConfig is undefined"

at this livewire.js code

function getCsrfToken() { if (document.querySelector("[data-csrf]")) { return document.querySelector("[data-csrf]").getAttribute("data-csrf"); } if (window.livewireScriptConfig["csrf"] ?? false) { return window.livewireScriptConfig["csrf"]; // this one } throw "Livewire: No CSRF token detected"; }

also if i use or dont wire:navigate. I'm always getting error - Uncaught TypeError: carry is null

at this livewire.js code

function dataGet(object, key) { if (key === "") return object; return key.split(".").reduce((carry, i) => { if (carry === void 0) return void 0; return carry[i]; //this line }, object); }

0 likes
2 replies
lupinitylabs's avatar

I am encountering the same issue when using the ESM-approach that's outlined in https://livewire.laravel.com/docs/installation#manually-bundling-livewire-and-alpine.

Instead, I listen to the alpine:init event, and then just use the Alpine instance Livewire created.

Make sure you do not import Alpine from 'alpinejs' yourself, and of course also don't Alpine.start() yourself.

document.addEventListener('alpine:init', () => {
    Alpine.plugin(Clipboard)
    Alpine.data('myComponent', () => {
			return {
				...
			}
	})
});

Please or to participate in this conversation.