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

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…?

1 Like
  1. “p5.js” - use for development:
<script async src=https://Unpkg.com/p5></script>
<script defer src=sketch.js></script>
  1. “p5.min.js” - use for deployment:
<script async src=https://cdn.JsDelivr.net/npm/p5></script>
<script defer src=sketch.js></script>

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?

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

1 Like

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

  • The opposite of it! It won’t await for anything! :running_man:
  • Use async for “p5.js” only if you’re not using add-ons for it! :warning:
  • Otherwise use defer, which it is much safer. :shield:



Another related question.

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

So this:

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


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

and why?

I guess either is OK. :man_shrugging: