<p>Screenshot looks like FE, not BE.</p>
<p>This happens when you use <code>{% js on load %}</code> or <code>{% js on ready %}</code></p>
<p>For now I switched to <code>{% js %}</code> and wrapped my script with <code>jQuery(function ($) { ... })</code></p>

CC BY-SA 4.0
2021-08-14T13:35:32.197Z
2021-08-17T20:52:08.177Z
2021-08-17T20:52:08.177Z
Leo Leoncio
<p>If any of your image transforms have not previously been processed they will make a call to <code>/cpresources/...</code> To prevent this, generate all your transforms before page load with the <a href="https://craftcms.com/docs/3.x/config/config-settings.html#generatetransformsbeforepageload" rel="nofollow noreferrer">generateTransformsBeforePageLoad</a> config setting:</p>
<pre><code>'generateTransformsBeforePageLoad' =&gt; true
</code></pre>

CC BY-SA 4.0
2020-12-20T03:14:05.017Z
What do image transforms have to do with jquery?
Bryce
CC BY-SA 4.0
2020-12-18T09:04:57.653Z
2020-12-18T09:04:57.653Z
James Smith
<p>I've been doing some performance checks on a website I'm building, and noticed that jQuery 3.5.1 is being loaded via cpresources:</p>
<p><a href="https://i.sstatic.net/tyIrj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tyIrj.png" alt="Sources pabel" /></a></p>
<p>Why is it doing this? And can I stop it? I'm already loading jQuery 3.5.1 in my <code>scripts.js</code> file (combined with some other stuff and minified using gulp &amp; webpack).</p>

CC BY-SA 4.0
2020-12-17T22:09:23.057Z
Do you have any plugins installed?
dmatthams
CC BY-SA 4.0
2020-12-20T03:13:40.137Z
I do ya... come to think of it, I bet Wheel Form is the culprit
Bryce
<cache><optimization>
Why is Craft loading jQuery via cpresources? And can I stop it?
# Why is Craft loading jQuery via cpresources? And can I stop it?

(Asked by: username_0 on 2020-12-17)

I've been doing some performance checks on a website I'm building, and noticed that jQuery 3.5.1 is being loaded via cpresources:

[![Sources pabel](https://i.sstatic.net/tyIrj.png)](https://i.sstatic.net/tyIrj.png)

Why is it doing this? And can I stop it? I'm already loading jQuery 3.5.1 in my `scripts.js` file (combined with some other stuff and minified using gulp & webpack).

**Tags:** cache, optimization

> **Comments:**
> **username_1**: Do you have any plugins installed?  
> **username_0**: I do ya... come to think of it, I bet Wheel Form is the culprit  

---

## 2 answers

### Answer by username_2 on 2021-08-14. Score: 1

Screenshot looks like FE, not BE.

This happens when you use `{% js on load %}` or `{% js on ready %}`

For now I switched to `{% js %}` and wrapped my script with `jQuery(function ($) { ... })`


---

### Answer by username_3 on 2020-12-18. Score: 1

If any of your image transforms have not previously been processed they will make a call to /cpresources/... To prevent this, generate all your transforms before page load with the generateTransformsBeforePageLoad config setting:
'generateTransformsBeforePageLoad' => true

> **Comments:**
> **username_0**: What do image transforms have to do with jquery?  

---

