Skip to content

main .js cannot find the audio worklet .js file, if it's not in the root directory #20316

Open
@FrancoisRecisio

Description

@FrancoisRecisio

Hello! 👋
I'm working on an electron project that includes a cpp project compiled with emscripten, and which uses audio worklets. It works well!
However I have a little problem with this line:

audioWorklet.addModule('{{{ TARGET_BASENAME }}}.aw.js').then(() => {

My project structure looks like:

root/
     folder1/subfolder/
           project.js
           project.wasm
           project.worker.js
           project.aw.js

but addModule in project.js doesn't find project.aw.js, except if my project structure is:

root/
     project.aw.js
     folder1/subfolder/
           project.js
           project.wasm
           project.worker.js

Do you think it would be possible to modify the line
audioWorklet.addModule('{{{ TARGET_BASENAME }}}.aw.js').then(() => {
as
audioWorklet.addModule(locateFile('{{{ TARGET_BASENAME }}}.aw.js')).then(() => {

Thanks :)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions