That “p5.voronoi” library is meant for sketches using the “global mode” approach only:
  
  
    
      
/* 
MIT License
Copyright (c) 2018 Francisco Moreira
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
show original 
   
  
    
    
  
  
 
It means at the very least your main “sketch.js” file gotta use the “global mode” approach as well.
 dansumption:
 
I am trying to write an app using ES6 modules and the voronoi library, and in this environment all of the processing instance functions ( background , stroke , random , etc) are not in the module’s namespace.
 
 
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:
  
  
    
  .block 
  height: 600
scrolling: no
border: yes
license: cc-by-4.0calc.mjs 
  const ERRORS = [
  "Polygon's newSize parameter can't be less than 2!",
  "Parameter dots[] must contain at least 2 { x, y } objects!",
  "Parameter epsilon can't be a negative value!"
];
export default function reducePolygon(dots, newSize, debug=true) {
  if (newSize < 2)  throw RangeError(ERRORS[0]);
  let reduced, ep = 0;show original 
  data.mjs 
  export default function mapXYTableToXYArray(t, asVectors=false) {
  return t.getArray().map(asVectors && xyArrToVecMap || xyArrToXYObjMap);
}
function xyArrToVecMap([ x, y ]) {
  return p5.instance && createVector(+x, +y) || new p5.Vector(+x, +y);
}
function xyArrToXYObjMap([ x, y ]) {
  return { x: +x, y: +y };show original 
    There are more than three files. show original