TypeScript Build Errors in Amity SDK

Hi team,

We are started working with Amity typescript SDK by following the link : https://docs.amity.co/installation-and-authentication/install-ts-reactnative-sdk

But when we are going to create a build then it shows lots of errors regarding the SDK.
I attached the Image of the logs to understands you. Please check and give us a solutions so we can start further. development.

Hey @ahmedsakri,

Thank you for reaching out. Could you provide some additional info please. Like the version of SDK you are using. Looks like you are using vite, I’ll need to check if additional configs are required for Vite.

In the meatime:

  1. Could you please check if the dist folder inside node_modules/@amityco/ts-sdk has @types defined?
  2. Try this or a similar vite plugin too please

Kind regards,
Cijin

Hey @cijin ,

Thanks for immediate response. Please refer below versions that i am using in my application.

  • “vite”: “4.0.4”
  • “amityco/ts-sdk”: “^6.2.0”
  • “typescript”: “4.9.4”

I tried the Vite plugin but didn’t work for me. it gives me the same error as earlier.
I checked the dist folder, @types is defined there. ( i have attached the screenshot below )

Thanks

Hey @ahmedsakri,

I was on leave but I’m back to work today. I’ll create a ticket and try to reproduce this issue. Will get back to you with some update.

Thank you for being patient.

Kind regards,
Cijin

1 Like

Hey @ahmedsakri,

I’ve tried to use the SDK with an official vite template for React Typescript.
Types work as expected. The build does succeed as well without any errors. I’m unable to reproduce your issue.

These are the versions I’m using:

  "dependencies": {
    "@amityco/ts-sdk": "^6.2.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/react": "^18.0.28",
    "@types/react-dom": "^18.0.11",
    "@typescript-eslint/eslint-plugin": "^5.57.1",
    "@typescript-eslint/parser": "^5.57.1",
    "@vitejs/plugin-react": "^4.0.0",
    "eslint": "^8.38.0",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.3.4",
    "typescript": "^5.0.2",
    "vite": "^4.3.2"
  }

Also, highly unlikely that this is an SDK issue. Feel free to let me know if I can help you with anything
else.

Kind Reagards,
Cijin

Hi @cijin,

This errors occurs when we ran “tsc & vite build” command.

Thanks

Hey @ahmedsakri,

Yup, I ran the command. I’ve added a screenshot of the cli output.

Hey @cijin,

It would be great if we can connect on a quick call. A google meet maybe?
Because, the issue occurs to me. When i run command build: tsc && vite build

vite.config.ts includes below config:

///
import react from ‘@vitejs/plugin-react’;
import { defineConfig } from ‘vite’;

export default defineConfig({
plugins: [react()],
server: {
port: 3001,
},
});

Hey @ahmedsakri,

I am sorry but I’ve got a few other things to take care of. As it’s not an SDK issue I’m afraid I can’t be of much help. As I’m not aware of the configs you are using.

You could try updating vite see if that solves the issue. The same one that I used in the response above.

If there is an SDK specific issue please reach out.

Kind regards,
Cijin