You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uncaught TypeError: Cannot convert object to primitive value
at Array.join (<anonymous>)
at Object.formatArgsAsString (utility.js:676:17)
at e2.<computed> [as log] (telemetry.js:520:23)
Based on my understanding
the problem stems from the formatArgsAsString and typeName functions.
The function typeName(x) returns 'module'.
Due to this, within formatArgsAsString, the code fails to satisfy any condition in the switch statement.
The final line of formatArgsAsString is return result.join(' ');.
This results in an error because the join method attempts to call toString, which does not exist in this context.
Consequently, JavaScript attempts to convert the object to a string and fails, leading to the error message: "Cannot convert object to primitive value."
(in module.js, if we add export const toString = () => 'hello'; the error is not raised.)
In a React project using ViteJS, console.logging the result of a dynamic import triggers an error in Rollbar.
Example code to replicate the issue:
App.jsx
module.js
export const x = 1;
The error raised is ;
Based on my understanding
the problem stems from the formatArgsAsString and typeName functions.
The function typeName(x) returns 'module'.
Due to this, within formatArgsAsString, the code fails to satisfy any condition in the switch statement.
The final line of formatArgsAsString is
return result.join(' ');.
This results in an error because the join method attempts to call toString, which does not exist in this context.
Consequently, JavaScript attempts to convert the object to a string and fails, leading to the error message: "Cannot convert object to primitive value."
(in module.js, if we add export const toString = () => 'hello'; the error is not raised.)
Possible correction could be :
or more generic adding a default :
The text was updated successfully, but these errors were encountered: