chat-uikit-react
chat-uikit-react copied to clipboard
process.env throw an error when searching to add a contact
It's not working when searching to add a contact using Vite.
Error:
useConversationCreate.js:1 Uncaught (in promise) ReferenceError: process is not defined
at useConversationCreate.js:1:2258
at step (tslib.es6.mjs:147:21)
at Object.next (tslib.es6.mjs:128:51)
at fulfilled (tslib.es6.mjs:118:56)
(anonymous) @ useConversationCreate.js:1
step @ tslib.es6.mjs:147
(anonymous) @ tslib.es6.mjs:128
fulfilled @ tslib.es6.mjs:118
Promise.then (async)
step @ tslib.es6.mjs:120
(anonymous) @ tslib.es6.mjs:121
__awaiter @ tslib.es6.mjs:117
onChange @ ConversationCreateUserSelectList.js:1
onChange @ Input.js:1
callCallback2 @ react-dom.development.js:4164
invokeGuardedCallbackDev @ react-dom.development.js:4213
invokeGuardedCallback @ react-dom.development.js:4277
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:4291
executeDispatch @ react-dom.development.js:9041
processDispatchQueueItemsInOrder @ react-dom.development.js:9073
processDispatchQueue @ react-dom.development.js:9086
dispatchEventsForPlugins @ react-dom.development.js:9097
(anonymous) @ react-dom.development.js:9288
batchedUpdates$1 @ react-dom.development.js:26140
batchedUpdates @ react-dom.development.js:3991
dispatchEventForPluginEventSystem @ react-dom.development.js:9287
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ react-dom.development.js:6465
dispatchEvent @ react-dom.development.js:6457
dispatchDiscreteEvent @ react-dom.development.js:6430
https://github.com/TencentCloud/chat-uikit-react/blob/5f20ac5f6000c420803beb71b57d789572987572/src/components/ConversationCreate/hooks/useConversationCreate.tsx#L91
There is only import.meta.env as I'm using Vite. And the process.env
would have error and crash this functionality to add contact.
However, I have to pre define a process
before use chat-uikit-react to make it works:
globalThis.process = globalThis.process || {}
It's not working when searching to add a contact using Vite.
Error:
useConversationCreate.js:1 Uncaught (in promise) ReferenceError: process is not defined at useConversationCreate.js:1:2258 at step (tslib.es6.mjs:147:21) at Object.next (tslib.es6.mjs:128:51) at fulfilled (tslib.es6.mjs:118:56) (anonymous) @ useConversationCreate.js:1 step @ tslib.es6.mjs:147 (anonymous) @ tslib.es6.mjs:128 fulfilled @ tslib.es6.mjs:118 Promise.then (async) step @ tslib.es6.mjs:120 (anonymous) @ tslib.es6.mjs:121 __awaiter @ tslib.es6.mjs:117 onChange @ ConversationCreateUserSelectList.js:1 onChange @ Input.js:1 callCallback2 @ react-dom.development.js:4164 invokeGuardedCallbackDev @ react-dom.development.js:4213 invokeGuardedCallback @ react-dom.development.js:4277 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:4291 executeDispatch @ react-dom.development.js:9041 processDispatchQueueItemsInOrder @ react-dom.development.js:9073 processDispatchQueue @ react-dom.development.js:9086 dispatchEventsForPlugins @ react-dom.development.js:9097 (anonymous) @ react-dom.development.js:9288 batchedUpdates$1 @ react-dom.development.js:26140 batchedUpdates @ react-dom.development.js:3991 dispatchEventForPluginEventSystem @ react-dom.development.js:9287 dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ react-dom.development.js:6465 dispatchEvent @ react-dom.development.js:6457 dispatchDiscreteEvent @ react-dom.development.js:6430
https://github.com/TencentCloud/chat-uikit-react/blob/5f20ac5f6000c420803beb71b57d789572987572/src/components/ConversationCreate/hooks/useConversationCreate.tsx#L91
There is only import.meta.env as I'm using Vite. And the
process.env
would have error and crash this functionality to add contact.However, I have to pre define a
process
before use chat-uikit-react to make it works:globalThis.process = globalThis.process || {}
Thank you very much for your response and suggestion. you can define a process before use chat-uikit-react as a temporary solution:
globalThis.process = globalThis.process || {}
At the same time, we can resolve this issue as soon as possible so that you can use our products better. Thank you again for your patient response and support.