2
jQuery를 Laravel 5.4와 함께 사용하려고합니다. npm으로 jQuery를 설치했다. 같은 폴더에 두 개의 파일 (app.js
및 bootstrap.js
)이 있습니다. 내가하려고 할 때 내 블레이드보기에서 여전히jQuery를 Laravel과 함께 사용하려면 어떻게해야합니까?
window.$ = window.jQuery = require('jquery');
:
<script>
$(document).ready(function() {
console.log('jQuery is working!');
});
</script>
나는 대한 참조를 가져 bootstrap.js
에서
require('./bootstrap');
내가 함께 jQuery를 가져옵니다 app.js
에서 나는있는 파일 bootstrap.js
을 가져 "$는 정의되지 않았습니다"라는 오류가 발생했습니다.
내가 잘못하고있는 것에 대한 아이디어가 있습니까? 미리 감사드립니다.
예! 그러나'async' 속성은'script' 태그에서'async'로 설정했습니다. 그것을 해결! – louisfischer