<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Laravel Echo</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pusher/7.0.3/pusher.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/laravel-echo/1.16.1/echo.min.js"></script>
<script type="module">
document.addEventListener('DOMContentLoaded', function () {
if (window.Echo) {
console.log('Laravel Echo is loaded');
} else {
console.error('Laravel Echo is not loaded');
}
});
</script>
</body>
</html>
Here is my simple example to test the Echo is loaded or not I used the echo.min.js however the pusher is loaded successfully. But Received an error that Echo is not defined. could you please help to resolve this issue?
type="module"for one of your<script>tags, but not the other two (in one of which is where I assumewindow.Echo = ...is defined).