How to access p5js functions when using ES6 modules

That “p5.voronoi” library is meant for sketches using the “global mode” approach only:

It means at the very least your main “sketch.js” file gotta use the “global mode” approach as well.

If p5.js is loaded via <script>, it dumps itself on the global namespace & thus it can be accessed even by ES6 module files, as long as it finds setup() and/or draw() on the global namespace as well, like this: window.setup = function () {}

Here’s a p5.js global mode sketch example using ES6 module files: