Using p5.sound.js in instance mode: 'p5.Amplitude() not a constructor'
问题 I am using an npm, webpack, babel environment to write an application with p5.js. To be able to have the sketch as a module, I have the sketch in instance mode and import the library and add-ons as modules: import p5 from 'p5'; import 'p5/lib/addons/p5.sound'; import 'p5/lib/addons/p5.dom'; Then I load them to the window inside my sketch: const sketch = (p5) => { window.p5 = p5; ... } new p5(sketch); When I try to use: amp = new p5.Amplitude() I get a 'p5.Amplitude is not a constructor' error