
How do import the package? Where do you get the error, in the browser?

I get the error in the browser console

I am importing the package as a default import:
import api from '@/lib/appwrite';

I mean inside api package

sure, just a sec

import {
Client,
Account,
Databases,
Teams,
Functions,
Storage,
Avatars,
} from 'node_modules/appwrite';

Can you try to change it to this
import {
Client,
Account,
Databases,
Teams,
Functions,
Storage,
Avatars,
} from 'appwrite';

And then run it?

The above works for JavaScript files but it does not resolve the import in TypeScript files

It should work with your TypeScript as well

What is the value of moduleResolution
within your tsconfig.json
file?

moduleResolution: 'bundler'

I'll share the TS error below:
Could not find a declaration file for module 'appwrite'. '/Users/rajiv/Development/xxx/node_modules/appwrite/dist/esm/sdk.js' implicitly has an 'any' type.
There are types at '/Users/rajiv/Development/xxxxx/node_modules/appwrite/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'appwrite' library may need to update its package.json or typings.ts(7016)

That's because it tries to load the js
file

Can you try to change to either node
or nodenext
and then you should be able to load the file as I've mentioned before

This 👆

Let me try that

The import does not work with node16
but works with node
👍

Good

So is the error still appears?

Thanks! The error does not appear anymore

👍

😃

[SOLVED] Syntax Error: The requested module does not provide export fetch

[SOLVED] Syntax Error: The requested module does not provide an export named 'fetch'
Recommended threads
- login backend and frontend
I'm using Remix, as my Backend (node). and react on my frontend. Until now, i did SSR login. saved the secret.. and it's fine. For many simpler requests i wish...
- Stuck in Readonly Mode After Pro Subscri...
Hello team, I really need some urgent help. I recently resubscribed to the Pro plan hoping to get back into a project I created a while ago, but I'm still unab...
- Missing C++ libstdc library in Python fu...
I have a function running Python 3.12 which suddenly started dumping errors (as of today; it worked yesterday). I hadn't changed any code so I found this odd, b...
