Back

Using Appwrite on the Web with Vanila Javascript

  • 0
  • Auth
  • Web
Ige Fadele
27 Apr, 2024, 19:37

I need to use Vanilla Javascript to sign in user and also createJwt(). I have added the cdn script to use the appwrite in my scripts Tag as required, however, I am getting error that Client, Account, etc are not found.

Also I can't use import... In Vanila Javascript (not in a node environment)

I'm the TypeScript lover and hates using vanilla JS for many reasons, but it's required in this case.

TL;DR
Solution: To utilize Appwrite in Vanilla JavaScript, you can solve the issue by directly including the Appwrite SDK from a CDN link without importing specific modules. This approach will allow you to access functionalities like Client and Account without encountering 'module not found' errors. Additionally, refrain from using import statements in Vanilla JavaScript as they are not supported outside a Node environment.
Ige Fadele
27 Apr, 2024, 19:38

@Moderator

D5
27 Apr, 2024, 19:52

It's not needed to ping all the moderators 😅

D5
27 Apr, 2024, 19:52

I think adding this like to the start of the code should solve the issue:

TypeScript
import { Client, Account } from 'appwrite';
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more