Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wktdev opened this issue Mar 11, 2018 · 5 comments
Open

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

wktdev opened this issue Mar 11, 2018 · 5 comments

Comments

@wktdev
Copy link

wktdev commented Mar 11, 2018

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
Copy link
Contributor

jamen commented Mar 11, 2018

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
Copy link
Author

wktdev commented Mar 11, 2018

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
Copy link
Contributor

jamen commented Mar 11, 2018

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
Copy link
Author

wktdev commented Mar 11, 2018

Thank you. I will

@wktdev
Copy link
Author

wktdev commented Mar 12, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants