title: Laravel / Livewire does not work in laravel mix complied app.js
body: <p>I use Laravel with Livewire. I wanted to react to an event in js. Once its emitted, an js alert should appear.
  The problem seems to be in app.js were I have my js function. I receive an error, Livewire is not available. I use Laravel Mix to compile it, and it compiles all fine.</p>
  <pre><code>Error: Uncaught TypeError: Livewire.on is not a function
  </code></pre>
  <p>app.js:</p>
  <pre><code>import Livewire from '../../vendor/livewire/livewire/dist/livewire'; 
  Livewire.on('testEvent', function () {
    alert(&quot;test&quot;);
  });
  </code></pre>
  <p>It looks like an import problem. I've removed the package and tried it again and I also thought its a timing problem, so I executed on document load but still the same problem.
  I've then decided to push it directly to the stack through a components blade file, and here it works all fine.</p>
  <pre><code>@push('scripts')
  &lt;script&gt;
     Livewire.on('testEvent', function () {
     alert(&quot;test&quot;);
     });
  &lt;/script&gt;
  @endpush
  </code></pre>
  <p>Pushing it to the stack should not be required as I've seen other code snippets without it and the error seems to be a simple import problem?</p>