-
Notifications
You must be signed in to change notification settings - Fork 33
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
ESM Modules Support / importScripts Errors #983
Comments
Hi Pavel, thanks for your nice words. I'm pretty sure that standardized-audio-context/test/expectation/firefox/current/audio-context-constructor.js Line 12 in 8a3c874
standardized-audio-context/test/expectation/firefox/current/audio-context-constructor.js Line 12 in 8a3c874
I think it would be theoretically possible to implement this somehow as part of standardized-audio-context but it would be a lot of work and it would significantly increase the bundle size. I'm not sure if it would be desirable anyway. I think for performance reasons it's better to not do any module resolution on the audio thread and instead load a bundle without any external imports. An alternative would be to use the global scope. By definition there is only one // a.js
const a = 1; // b.js
const b = a + 1; await audioContext.audioWorklet.addModule('./a.js');
await audioContext.audioWorklet.addModule('./b.js'); Sadly this is not supported in Chrome (and Edge and Opera).
From reading the issues that you referenced (and from my experience) I can see that bundling an I hope this helps. |
Thanks for the detailed analysis, Chris! Very much appreciated, and we'll see what we can do with this. Will post any updates if we come across anything breaking, as I am sure others could benefit from this as well. |
Yes, please. I'm sure this is a problem many people struggle with. Another option that just came to my mind would be to move your |
Hi there, thank you for the wonderful work upkeeping this as always.
Not sure if this is the right place, but wanted to get some insight on this. Our team is currently in the process of transitioning our main project to webpack 5, and we are unable to get worklets working with it. Essentially, webpack is splitting imports that we have inside our WorkletProcessor code into chunks and tries to inject them back using
importScripts
directive at run-time. From what I understand, importing doesn't work in processors whatsoever (please correct me if I am wrong), and so we are stuck there.Please take a look at the issues being outlined here:
webpack/webpack#11543
vercel/next.js#24907
vercel/next.js#29472
Would love to hear your thoughts on this, and see if anything can be done from your library's side, or if there is anything that we could be doing right, as our knowledge of WebAudio is not as advanced.
The text was updated successfully, but these errors were encountered: