Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install issue with Laravel 7 #121

Open
timgavin opened this issue Mar 29, 2020 · 1 comment
Open

Install issue with Laravel 7 #121

timgavin opened this issue Mar 29, 2020 · 1 comment

Comments

@timgavin
Copy link

I followed the installation instructions but I continue to receive the js error

can't find variable: swal

bootstrap.js

...
try {
    window.Popper = require('popper.js').default;
    window.$ = window.jQuery = require('jquery');

    require('bootstrap');
    require('sweetalert');
} catch (e) {}
...

app.js

require('./bootstrap');

$( document ).ready(function() {
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
});

app.blade

...
    @include('sweet::alert')
</body>

Then I run npm run prod

The only way I can get it to work is if I use the CDN....

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
@chuysb
Copy link

chuysb commented Jul 13, 2020

In your bootstrap.js, try adding this to your try catch block:

const swal = require('sweetalert');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants