jeudi 3 mai 2018

Laravel, js in webpack.mix, function not found

I'm using Laravel 5.6. In webpack.mix.js I have this:

.js([
    'resources/assets/js/backend/before.js',
    'resources/assets/js/backend/app.js',
    'resources/assets/js/backend/after.js',
    'resources/assets/js/backend/funcionesJquery.js',//THIS IS NEW
    'resources/assets/js/backend/events.js',
], 'public/js/backend.js')

Ok, now functioncesJquery.js is only this:

alert("LOADEAD");
function testAlert(){
    alert("TEST");
}

Now in a view I have this:

@push('after-scripts')
<script>
    testAlert();
</script>
@endpush

When I load the page with that view, it shows the alert("LOADEAD"); but I'm getting a function not found anyway with testAlert(). Why is happening that? the code is well loaded but why it doesn't find the function.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2wbTbos
via IFTTT

Aucun commentaire:

Enregistrer un commentaire