laravel-view-xray
laravel-view-xray copied to clipboard
Just a tip for those having issues...
Like many others here, I too had an issue where nothing would happen, but I could see the comments in the HTML. There was no error message, no "Ready to Xray. Press cmd+shift+x to scan your UI.".
Many may not know or even notice, but the loading of the default Laravel app.js (which includes jQuery) in layouts/app.blade.php is deferred.
Meaning the inline Xray script ends up being run before the app.js and exits because jQuery has not yet loaded.
Replacing
<script src="{{ mix('js/app.js') }}" defer></script>
with
<script src="{{ mix('js/app.js') }}"></script>
Or even
<script src="{{ mix('js/app.js') }}" {{env('APP_ENV') !== 'production' ? '' : 'defer'}}></script>
will fix the issue.
Thank You!