Skip to content

Issues when trying add webex widget to vite react app #512

@RayyanX95

Description

@RayyanX95

I am trying to add webex widgets to my react vite app with these versions:

  • "react": "^18.3.1",
  • "vite": "6.3.5",

I got this error:

Image

After adding polyfile.ts file and import it into the src/index.ts with these content:

if (typeof global === "undefined") {
    // @ts-ignore
    window.global = window;
    if (typeof globalThis !== "undefined") {
        // @ts-ignore
        globalThis.global = globalThis;
    }
}

I got this error:
Image

After adding util-shim.ts file I got this error with these content:

function inherits(ctor, superCtor) {
  ctor.prototype = Object.create(superCtor.prototype, {
    constructor: {
      value: ctor,
      enumerable: false,
      writable: true,
      configurable: true,
    },
  });
  Object.setPrototypeOf(ctor, superCtor);
}

const util = { inherits };
util.inherits = inherits; // Ensure util.inherits is a direct property

export { inherits };
export default util;

// For CommonJS consumers (Vite CJS emulation)
if (typeof module !== "undefined" && module.exports) {
  module.exports = util;
  module.exports.inherits = inherits;
}
Image

After importing the process to the polyfile.ts, I got this error:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions