• Resolved nicegamer7

    (@nicegamer7)


    Hi Sayontan,

    I just updated from a rather old version (2.45) to the latest version. Everything is working as expected, but I’m seeing a warning in the console. I don’t completely understand it because my knowledge of modern JS is a little lacking.

    Here it is:

    View post on imgur.com

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter nicegamer7

    (@nicegamer7)

    Oh, I forgot to mention, I also use Cloudflare’s Rocket Loader and this warning appears before the warning I linked above:

    View post on imgur.com

    Plugin Author Sayontan Sinha

    (@sayontan)

    This would be something to do with CloudFlare’s settings. My guess is that CloudFlare might be making some assumptions around how the content is being used on a page, and it might not be considering all scenarios. On a page loaded straight, there are no such warnings.

    One thing I would suggest checking is verifying your page source: the script that is coming up with a warning should have a type="module" setting (take a look at the source for one of my pages). If it doesn’t, then CloudFlare is likely changing things that it shouldn’t, and that is problematic: rather than loading an optimized script once, CloudFlare is loading 2 scripts that perform the same function.

    Thread Starter nicegamer7

    (@nicegamer7)

    So it is caused by RocketLoader.

    After turning RocketLoader off, the warnings go away. Although, even with RocketLoader on, the script still had the correct type attribute.

    Regardless, I’ll just keep it off. Thanks, Sayontan.

    Plugin Author Sayontan Sinha

    (@sayontan)

    It might be possible to selectively disable RocketLoader for specific plugins. I know that some other caching / CDN plugins let you do that.

    Also, my guess is that RocketLoader might have had some internal logic, which was checking to see if module type of scripts had explicit invocation in the markup of the page. If such an explicit invocation did not exist, it might have had a call to console.warn() (i.e. the warning was coming from within RocketLoader rather than your browser). In Photonic there is no explicit invocation in the page markup, and maybe that is why RocketLoader was thinking that it is not being used and was triggering the warning.

    Thread Starter nicegamer7

    (@nicegamer7)

    Yes, there is indeed a way to disable Rocket Loader (it turns out it’s called Rocket Loader, not RocketLoader, sorry) for individual scripts.

    I’m not sure whether this should be something the plugin does automatically or if it should be available via a filter, but I think it must somehow be integrated in the plugin. See here.

    edit: I also question whether this is even needed, as the plugin seems to function correctly, even with the warning. Although, you did mention the double loading that this would be causing, so in that sense I guess it is necessary.

    • This reply was modified 5 years, 1 month ago by nicegamer7.
    Plugin Author Sayontan Sinha

    (@sayontan)

    edit: I also question whether this is even needed, as the plugin seems to function correctly, even with the warning. Although, you did mention the double loading that this would be causing, so in that sense I guess it is necessary.

    I don’t believe there is a double-loading happening if you are seeing one script included with the type="module" setting and another with nomodule. Double-loading would happen if any of of these was dropped.

    So I think you are OK even with the warning.

    Thread Starter nicegamer7

    (@nicegamer7)

    Okay, I do see both. So I suppose all is good.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Preload Warning’ is closed to new replies.