audiojs / audio

Class for high-level audio manipulations [NOT MAINTAINED]
MIT License
240 stars 9 forks source link

Instructions omit how to get "require" to work #50

Open wktdev opened 6 years ago

wktdev commented 6 years ago

Edited (sorry for the confusion). The title of this query is wrong.

I tried to use your library with react-create-app and the method "load" is simply not found. It does find the library however when required. When I go into the module folder and look in the audio folder it looks like most of the library is missing. I feel like I am missing an install step

jamen commented 6 years ago

Thanks for raising this.

I made a test app, ran npm i audio, and was able to import it:

import Audio from 'audio'

Tooling does not really care whether you use CJS (requires) or ESM (imports) anymore.

But, that being said, maybe we should consider transitioning our packages and examples towards ESM, since lately it has became much more popular. I know who are in audio.js like using browserify, but I'm not sure this supports ESM without Babel or plugins. I switched to Rollup a while ago and really enjoy it! I'll wait for more feedback on what others think though.

wktdev commented 6 years ago

It imports it without error, but when I try to run any methods I get errors. I've screen shot an example here: https://imgur.com/a/wHLn5

When I do any web audio api oscillator work it is fine, it's just the audio methods that are not working. Again, when I look in the module folder and go into the audio folder I don't see much there. It looks as if the module is missing most of its requirements. Let me know if I am misunderstanding a step.

audio_error

jamen commented 6 years ago

Ah my bad, I installed the wrong package. The code under audio is my 2 year old package! We have not published yet. Instead try:

npm i audiojs/audio
wktdev commented 6 years ago

Thank you. I will

wktdev commented 6 years ago

It now has a different error.

Here's a screenshot:

https://imgur.com/a/eFGPK

capture

Here is a screenshot of my app.js file:

https://imgur.com/a/ZP6JH

code_editor