renatomarinho / laravel-page-speed

Package to optimize your site automatically which results in a 35%+ optimization
MIT License
2.4k stars 275 forks source link

jQuery stopped working after installing the package #145

Open nitinjohnson opened 3 years ago

nitinjohnson commented 3 years ago

I wanted to minify html output so I have used the renatomarinho/laravel-page-speed package. I have done as per the instruction on its github page https://github.com/renatomarinho/laravel-page-speed. But for some reason now the jquery stopped working after installing this package. I thought this issue was caused due to the comments in javascript file so i have removed all the comments from the js library files that I have included. But still jquery is not working. Please help me out. Please check the attached image.

error

lucasMesquitaBorges commented 3 years ago

Hi @nitinjohnson! Can you make the diff of html with and without the package enabled? This way we will be able to detect was is causing the issue.

Munira-Akter commented 2 years ago

I have face the same issue any of my jquery code not working after enabling this package. What to do please guide us

TimBiesmans commented 2 years ago

Have the same problem. When disabling the package it's working fine.

zawaruddin commented 2 years ago

i've same problem, but i try to comment middleware DeferJavascript::class in Kernel.php and it's work

nasirkhan commented 10 months ago

I faced the same issue with Laravel 10. removing DeferJavascript::class does not solved the issue for me.

Rikj000 commented 6 months ago

I faced the same issue with Laravel 10. removing DeferJavascript::class does not solved the issue for me.

Make sure that jquery.js is still loaded before your own JavaScript after laravel-page-speed compressed the page.

For me this initially was not the case anymore, I resolved my issue by moving the JS imports:

After that JQuery works properly, together with this package! :tada: