# P5.js vs p5.min.js; Which one should I use?

**URL:** <https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920>\
**Category:** Beginners\
**Created:** [April 19, 2020, 5:27am UTC](https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920 "2020-04-19T05:27:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bassam](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@Bassam](https://discourse.processing.org/u/Bassam)\
**Post date:** [April 19, 2020, 5:27am UTC](https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920/1 "2020-04-19T05:27:10Z")

</div>

Is there any harm in using the min version? I’m just wondering if it’ll be faster, take up less memory, be faster to download…?

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [April 19, 2020, 5:30am UTC](https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920/2 "2020-04-19T05:30:37Z")

</div>

1. “p5.js” - use for development:

```auto
<script async src=https://Unpkg.com/p5></script>
<script defer src=sketch.js></script>

```

1. “p5.min.js” - use for deployment:

```auto
<script async src=https://cdn.JsDelivr.net/npm/p5></script>
<script defer src=sketch.js></script>

```

---

<div class="post-metadata">

**Author:** ![Bassam](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@Bassam](https://discourse.processing.org/u/Bassam)\
**Post date:** [April 19, 2020, 5:33am UTC](https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920/3 "2020-04-19T05:33:23Z")

</div>

hmm what do you mean by development? Do you mean that while I’m working on a project in my own IDE, I should be using p5.js and when I decide to host my sketch on a webserver, I should use p5.min.js?

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [April 19, 2020, 5:34am UTC](https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920/4 "2020-04-19T05:34:33Z")

</div>

Exactly that! A minified library is harder to debug but faster to download. 😉

---

<div class="post-metadata">

**Author:** ![Bassam](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@Bassam](https://discourse.processing.org/u/Bassam)\
**Post date:** [April 19, 2020, 5:38am UTC](https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920/5 "2020-04-19T05:38:23Z")

</div>

async waits for the target file to download before it continues, correct?

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [April 19, 2020, 5:44am UTC](https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920/6 "2020-04-19T05:44:15Z")

</div>

> [@Bassam](#):
>
> `async` waits for the target file to download before it continues, correct?

- The opposite of it! It won’t await for anything! 🏃‍♂️
- Use `async` for “p5.js” only if you’re not using add-ons for it! ⚠
- Otherwise use `defer`, which it is much safer. 🛡

> **[HTMLScriptElement - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement)**
>
> HTML

---

<div class="post-metadata">

**Author:** ![Bassam](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@Bassam](https://discourse.processing.org/u/Bassam)\
**Post date:** [May 15, 2020, 1:15am UTC](https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920/7 "2020-05-15T01:15:40Z")

</div>

Another related question.

Should the p5.min.js file be on your web server or should you link to it?

So this:

```auto
<script async src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.0.0/p5.min.js"></script> 

```

OR

```auto
<script async src="p5.min.js"></script>

```

and why?

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [May 15, 2020, 5:07am UTC](https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920/8 "2020-05-15T05:07:24Z")

</div>

> [@Bassam](#):
>
> Should the p5.min.js file be on your web server or should you link to it?

I guess either is OK. 🤷‍♂️
