Skip to content

Difficulties importing Webex sdk into create-react-app #3841

@tomBarkerSwitchTelecom

Description

@tomBarkerSwitchTelecom

Describe the bug
I've followed the instructions on the "for browser consumption" page to import the webex sdk into a basic create react app (built from generic webpack config).

I'm getting a Module not found: Error: Can't resolve 'fs' in ".../node_modules/strtok3/lib" error.

I've looked into how to allow webpack/CRA to access fs and the documentation is stating that fs should not be included in browser code. (see here)

Is it expected that the SDK should load inside a react app?
Is there an expectation that webex has access to the fs library?
Should I be adding that library to the browser? (which is difficult as CRA explicitly prevents that)
Is there a work around to not require fs? (eg: not importing the entire webex module, but subsets)

Thanks for your assistance.

To Reproduce
Steps to reproduce the behavior:
I've pushed a stripped down version of a new app for your testing if desired, otherwise see below instructions,
https://github.com/tomBarkerSwitchTelecom/webex-test.

NB: webpack 5 causes a lot of "standard" packages to need to be manually installed which I haven't set out the instructions for below (but have done in the test app). I'll be opening another ticket for that and will link below once I've done that.

  1. npx create-react-app webex-test --template typescript
  2. cd webex-test
  3. npm install --save webex
  4. Add <script crossorigin src="https://unpkg.com/webex/umd/webex.min.js"></script> to index.html
  5. Add const Webex = require("webex"); to App.tsx
  6. npm start

Expected behavior
Expect application to be able to load following the installation instructions.

Screenshots
image

Platform (please complete the following information):

  • OS: [iOS]
  • Browser [chrome]
  • Version [3.4.0]
  • Device Type [Desktop]

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions