Closed rens-public closed 1 month ago
I think it would be better to use vite-plugin-env-compatible
rather than deliberately break something. Do you want to make a new PR? Or reset this back a few commits and redo it?
Something like this?
plugins: [
envCompatible({
process: true, // This enables the `process` global
}),
],
define: {
'process.versions.node': JSON.stringify(process.versions.node),
}
Or you may want to try this plugin in your own project to see if that resolves it?
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.