Re: Hi how do I defer shopify CDN scripts

How can I defer CDN scripts for faster custom theme development?

Zachums23
Tourist
16 0 2

Hi Shopify dev community I'm developing a custom theme for my store but at 0.9 second FCP its already very slow :[

I would get full paint at 0.4 seconds (i like) but there's some render blocking JS slowing down my site that isn't local to my theme folder. Its some scripts served from shopify CDN but I do not know what they do other then that fact that their (probably) served with any shopify hosted store.

 

temp.png

https://cdn.shopify.com/s/assets/storefront/load_feature-04598b77b1103a920783be825a5f4c245a91397360c...
https://cdn.shopify.com/s/assets/shopify_pay/storefront-21b5dddfc8b64c1ad68cee3ba7448d1ffa15c24e969e...
https://cdn.shopify.com/s/assets/storefront/features-87e8399988880142f2c62771b9d8f2ff6c290b3ff745dd4...
https://cdn.shopify.com/s/assets/shop_events_listener-2632023fb2795bd6668b6fbae05b661baba07afb3d6204...
https://cdn.shopify.com/s/javascripts/tricorder/trekkie.storefront.min.js?v=2020.07.13.1

 

Frankly I find hard to believe that shopify HAS to load 5 different scripts before it can render, so I must defer them. 

How do i do?

 

Thanks Shopify dev community

Replies 5 (5)

Zachums23
Tourist
16 0 2

bump

BananaMoon
Excursionist
64 1 5

Hello,

Whereas I totally agree with you, Shopify imposes us at least 500ms of first load JavaScript now (trekkie.js).

And you can't defer most Js Scripts now anymore, because all scripts are async loaded (but tricorder & trekkie put 500 ms of Javascript evaluation in all your themes).

This is beginning to be too much, way to much of overhead.

alexmiller17
Shopify Partner
26 1 6

I have this problem too

mfcss
Explorer
65 6 28

Agree, it would be nice with a guide on how to resolve this for speed optimization. Trekkie etc may be relevant for convenience, but they often load before the FCP/LCP, causing speed issues.

tnoetz01
Shopify Partner
1 0 0

Did you ever find a solution to this?