Closed albasyir closed 1 year ago
Hey @albasyir !
Thank you for opening this PR. I really appreciate it 🙏
However there is no need for this change. If you look at the HTML that's being generated you'll notice that the script tag has a defer
attribute which solves the problem.
https://www.w3schools.com/tags/att_script_defer.asp
Let me know if you have any additional questions
P.S. if you need to support older browsers that don't support defer
you may need to move the script tag to the bottom of the page, but for modern browsers there's really no need
Tested on fresh install
adonisjs
andinertiajs-adonisjs
, compiled js isn't load properlyThe script tag should always be used before the body closes or at the bottom of the HTML file. The Page will load with HTML and CSS and later JavaScript will load.
Placing scripts at the bottom of the
element improves the display speed, because script interpretation slows down the display.ref: