deepgram / deepgram-js-sdk

Official JavaScript SDK for Deepgram's automated speech recognition APIs.
https://developers.deepgram.com
MIT License
127 stars 45 forks source link

fix: process is undefined error in vite #278

Closed rens-public closed 1 month ago

rens-public commented 1 month ago

This pull request addresses an issue with the Deepgram SDK when used in Vite environments.

Currently, the SDK relies on the process.versions.node property to determine the Node.js version. However, in Vite environments, the process object is not available, leading to errors.

The proposed fix is a check to verify the existence of the process object before accessing process.versions.node. If process is undefined, the NODE_VERSION constant defaults to "unknown".

This change ensures compatibility with Vite and other environments where the process object is not accessible.