Environment
node.js
parcel
problem description
P5 has been downloaded to node_modules
how to import P5 in js files and use it
question 1:
the methods currently used are as follows
import p5 from "p5";
p5.setup = () =>{
}
p5.draw = () =>{
ellipse(50, 50, 80, 80);
}
in this way, the program does not export
when parcel is packaged, but it still doesn"t show up when you start the server
question 2:
the above is to introduce the whole package of p5 to
how to implement
if only the p5.min.js in this package of data is introduced.
import p5 from "./p5.min.js";
these sub-parcel will show error message when packing
C:\Users\user\Dropbox\p5\p5_one\src\script.js:3:15: Cannot resolve dependency "./p5.min.js" at "C:\Users\user\Dropbox\p5\p5_one\src\p5.min.js"