Skip to content

Conversation

smrg-lm
Copy link

@smrg-lm smrg-lm commented Jul 24, 2025

This patch makes the README Node example to work properly by changing the esbuild options so they work with Node.js require and package name. It also changes the file extension in the condition entry "main" which isn't working maybe due to fauswasm package.json being of "type": "module". Some options may be redundant since defining --platform=node should take care of --external:fs --external:url.

@smrg-lm smrg-lm mentioned this pull request Jul 24, 2025
@smrg-lm
Copy link
Author

smrg-lm commented Jul 24, 2025

Note: esm imports aren't working either in Node, the problem can be solved just by changing the extension the same ways as for cjs. I just don't want to mess too much around because there might be a different underlying issue with the configuration that's causing these problems.

@sletz
Copy link
Member

sletz commented Jul 24, 2025

@Fr0stbyteR what do you think ?

@Fr0stbyteR
Copy link
Collaborator

Thank you for the PR and the comments,
At the beginning of development, we needed to consider different use cases for this project, such as importing and running directly in the browser, importing and bundling using bundler/compiler with Node, and generating audio offline in a Node environment. I also needed to consider compatibility with the libfaust-wasm.js file generated by Emscripten, allowing it to be dynamically imported. Ultimately, we chose these outputs.
At the time, I thought the IIFE output would be suitable for developing static HTML pages that could run DSP directly upon opening the page. Some WebAudioModules might also use this output. This is why I copied the d.ts file so that developers could use it directly.
It's been a while I don't remember many of the details, so I might need some time to retest these methods using the changes suggested in this PR. Or perhaps rename them to make their purpose clearer.

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

Successfully merging this pull request may close these issues.

3 participants