Closed tanthammar closed 4 years ago
tanthammar Thanks for the PR & good spot. This changes makes sense since Livewire needs to hook into Alpine before it initialises.
@tanthammar - I've made a change similar to this as part of #61 - instead of placing the script afterwards, I've moved it to the <head>
of the document with a defer
attribute.
In a fresh installation of Laravel v7.21.1 and a simple Livewire form, I get the following error if alpine (app.js) is loaded before @livewireScripts. Maybe it doesn't matter but I just wanted to suggest that the default boilerplate doesn't result in this error.
alpine.js?df24:1825 Uncaught TypeError: Cannot read property '$wire' of undefined at Livewire.value (index.js:29) at eval (eval at saferEval (alpine.js?df24:1804),:3:70)
at saferEval (alpine.js?df24:115)
at Component.evaluateReturnExpression (alpine.js?df24:1666)
at new Component (alpine.js?df24:1431)
at Object.initializeComponent (alpine.js?df24:1822)
at eval (alpine.js?df24:1765)
at eval (alpine.js?df24:1781)
at NodeList.forEach ()
at Object.discoverComponents (alpine.js?df24:1780)