Azure / Communication

Azure Communication Services - SDKs and Release Notes
MIT License
317 stars 98 forks source link

Typescript error when using CallClient #306

Closed Roblinde closed 3 years ago

Roblinde commented 3 years ago

Describe the bug When I import CallClient the web app crashes with the error "./node_modules/@azure/core-http/es/src/serviceClient.js Attempted import error: '__spreadArray' is not exported from 'tslib'."

To Reproduce Steps to reproduce the behavior: Haven't found a way to reliably reproduce, but it does happen everytime I try to import the CallClient in our current code base. More context about that below.

Expected behavior Expected the __spreadArray function to be found.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context We are using tslib version 2.2.0 in a react app. We are using babel and the following tsconfig:

{
  "compilerOptions": {
    "outDir": "build/dist",
    "module": "esnext",
    "target": "es5",
    "lib": [
      "es6",
      "es2016",
      "es2017.object",
      "dom",
      "es2016.array.include"
    ],
    "sourceMap": true,
    "allowJs": false,
    "jsx": "react",
    "moduleResolution": "node",
    "rootDirs": [
      "src",
      "stories"
    ],
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": true,
    "strict": true,
    "suppressImplicitAnyIndexErrors": true,
    "skipLibCheck": true,
    "importHelpers": true,
    "baseUrl": "./src",
    "preserveConstEnums": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "isolatedModules": true,
    "noEmit": true,
  },
  "include": [
    "src",
    ".env.d.ts"
  ],
  "exclude": [
    "node_modules",
    "build",
    "scripts",
    "acceptance-tests",
    "webpack",
    "jest",
    "src/setupTests.ts",
    "types",
    "server"
  ]
}

I have tried multiple different configurations to see if I can get it to pick up the correct tslib type definitions, but nothing seems to work. Any help is appreciated.

akania commented 3 years ago

Hi, @Roblinde , can you please provide more details 1) which version of @azure/communication-calling 2) which version of @azure/communication-common

you're using in your project? Are you able to prepare minimal repo with repro?

ADO#2460545

Roblinde commented 3 years ago

Hi @akania

Of course, we are using version "@azure/communication-calling": "1.0.0","@azure/communication-common": "^1.0.0", but I initially tried with the @azure/communication-calling@1.1.0.beta.1 but ran into the same problem.

Roblinde commented 3 years ago

I'll see if I can get a repo with a reproduction. Will try to setup a create react app from scratch tomorrow if I can't get it to work with our current project soon.

chriswhilar commented 3 years ago

Hi @Roblinde, do you get the error if you do not import anything from @azure/communication-calling ?

Roblinde commented 3 years ago

Hi @cwhil2492 no, only when importing @azure/communication-calling. If left un-imported the app starts and runs fine.

chriswhilar commented 3 years ago

Hey @Roblinde, ok do you have a repo for your project with a readme on how to setup and run your project? We'll take a look. Is your app using any specific react framework like reactjs, react ionic, react native, etc... ? Also, there seems to be a newr version of tslib available, 2.3.0, can you try this version?

ghost commented 3 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.