I’ve tried installing with npm and then pointing a tag to the library but I must be doing something wrong?
I suspect this is a very simple process to follow but I just can’t get it to work.
Just copy the code that you need to a separate tab
So copy all code from the ~15 source module folders?
Isn’t there a better way to use external code that is more robust managing dependencies and code versions?
Perhaps some equivalent to require() or import that works with p5.js??
just put this in your html and use it …
Yes thank you!
It was this bundled/minimized script I needed.
File “package.json” has a “browser” entry w/ “dist/polygon-clipping.umd.js”:
That library is primarily for NodeJS. That’s why we have to look for the “browser” version file.
BtW, here’s a minimalist “index.html” to remotely load both “p5*js” & “polygon-clipping”, plus “sketch.js”:
<script defer src=//cdn.JsDelivr.net/npm/p5></script>
<script defer src=//cdn.JsDelivr.net/npm/polygon-clipping></script>
<script defer src=sketch.js></script>