elevenlabs / elevenlabs-js

The official JavaScript (Node) library for ElevenLabs Text to Speech.
https://elevenlabs.io
MIT License
149 stars 15 forks source link

bun support #87

Open hexxt-git opened 2 months ago

hexxt-git commented 2 months ago

i can't express enough my disappointment when i found out this library doesn't support bun

4 |  */
5 | Object.defineProperty(exports, "__esModule", { value: true });
6 | exports.ElevenLabsError = void 0;
7 | class ElevenLabsError extends Error {
8 |     constructor({ message, statusCode, body }) {
9 |         super(buildMessage({ message, statusCode, body }));
            ^
error: This function is only supported in node environments. bun is not supported
      at new ElevenLabsError (/home/hexxt/Documents/GitHub/Artificial-Intelligence-Agent/node_modules/elevenlabs/errors/ElevenLabsError.js:9:9)
      at /home/hexxt/Documents/GitHub/Artificial-Intelligence-Agent/node_modules/elevenlabs/wrapper/play.js:33:19
      at /home/hexxt/Documents/GitHub/Artificial-Intelligence-Agent/node_modules/elevenlabs/wrapper/play.js:8:71
      at new Promise (:1:11)
      at /home/hexxt/Documents/GitHub/Artificial-Intelligence-Agent/node_modules/elevenlabs/wrapper/play.js:4:12
      at play (/home/hexxt/Documents/GitHub/Artificial-Intelligence-Agent/node_modules/elevenlabs/wrapper/play.js:31:12)
      at /home/hexxt/Documents/GitHub/Artificial-Intelligence-Agent/tts.js:44:9
dsinghvi commented 2 months ago

@hexxt-git want to submit a PR here to allow it for bun https://github.com/elevenlabs/elevenlabs-js/blob/main/src/wrapper/play.ts ? This only applies to the play function

hexxt-git commented 2 months ago

@hexxt-git want to submit a PR here to allow it for bun https://github.com/elevenlabs/elevenlabs-js/blob/main/src/wrapper/play.ts ? This only applies to the play function

not really up to work for free to a paid api. but you sound interested maybe you should give it a go