wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

404 error in console on Safari when LazyLoad for CSS BG Images is active

Open webtrainingwheels opened this issue 1 year ago • 12 comments

Describe the bug When LazyLoad for CSS Background Images is active, Safari shows a 404 error in the console for: lazyload-css.min.js.map

It doesn't seem to break anything, but we shouldn't cause a console error.

To Reproduce Steps to reproduce the behavior:

  1. Enable LazyLoad for CSS Background Images
  2. Visit a page in Safari
  3. Check the console. Tested on WPR 3.15.9

Expected behavior No 404.

Screenshots If applicable, add screenshots to help explain your problem.

Acceptance Criteria (for WP Media team use only) Clear instructions for developers, to be added before the grooming

webtrainingwheels avatar Feb 22 '24 18:02 webtrainingwheels

I can't replicate this on Safari, I dont'have the error on console with lazyload CSS enabled

remyperona avatar Mar 18 '24 20:03 remyperona

Ticket: https://secure.helpscout.net/conversation/2543005887/481581/

girlie avatar Mar 19 '24 17:03 girlie

If you check on firefox it shows the 404 error for lazyload-css.min.js.map

Khadreal avatar Apr 17 '24 00:04 Khadreal

I have a similar case.

Found this: https://goonlinetools.com/snapshot/code/#5hmlsyg75yfn5wz8d5l0y

//# sourceMappingURL=lazyload-css.min.js.map

But lazyload-css.min.js.map doesn't exist.

This is the ticket: https://secure.helpscout.net/conversation/2586260422/489478

sandyfigueroa avatar May 02 '24 12:05 sandyfigueroa

We aren't generating the map file when gulp run, coincidentally this PR(https://github.com/wp-media/wp-rocket/pull/6625) fix the issue.

Khadreal avatar May 27 '24 12:05 Khadreal

@MathieuLamiot , if #6625 is fixing it, should we close this issue ?

Miraeld avatar Jun 02 '24 19:06 Miraeld

Yes, after confirming it's fixed.

MathieuLamiot avatar Jun 02 '24 19:06 MathieuLamiot

The file exists and is correctly mapped in the min file, we do have a stray lazyload-css.js.min.map that should not exist though.

remyperona avatar Jun 03 '24 19:06 remyperona

Closing the issue as the files have been updated to correctly match. Please re-open if the issue arise again.

remyperona avatar Jun 17 '24 13:06 remyperona

@piotrbak The issue here is that we are injecting the script on pages, which result on the sourcemap becoming relative path //# sourceMappingURL=lazyload-css.min.js.map .

Consequently, whatever is looking for sourcemap will look for it on the same current page's path.

Either remove the sourcemap or reference an absolute path for the sourcemap or include it as a file and not inline it.

DahmaniAdame avatar Jul 12 '24 07:07 DahmaniAdame

Related: https://secure.helpscout.net/conversation/2666064439/505227?folderId=2675957

camilamadronero avatar Aug 05 '24 15:08 camilamadronero