Back

error during build: RollupError

  • 1
  • Web
Manikanta
28 Aug, 2023, 11:28

App uses react +TS + vite

TL;DR
Issue: Error during build with RollupError Solution: 1. Move the file `appwriteConfig.ts` into the `src` folder. 2. Update the import statement to `import { account } from "../appwriteConfig";` 3. Change the file name to `appwriteConfig.ts` and update the import statement accordingly. 4. Initialize a client by following the instructions in the provided link: [https://appwrite.io/docs/getting-started-for-web#initSDK](https://appwrite.io/docs/getting-started-for-web#initSDK) 5. Update the import statement to `import { account }
Binyamin
28 Aug, 2023, 11:45

Can you share your code?

Manikanta
28 Aug, 2023, 11:52
Binyamin
28 Aug, 2023, 12:11

Change this

TypeScript
import { account } from "../../appwrite";

To this

TypeScript
import { account } from "appwrite";
Binyamin
28 Aug, 2023, 12:12

You'll also need initialize a client Check this

Manikanta
28 Aug, 2023, 12:29

I am exporting that from a file called appwrite.d.ts

Manikanta
28 Aug, 2023, 12:30

from root folder

Binyamin
28 Aug, 2023, 12:30

Yes

Binyamin
28 Aug, 2023, 12:30

I see now, why you've added the d in the .d.ts

Manikanta
28 Aug, 2023, 12:32

if I use .ts

Manikanta
28 Aug, 2023, 12:33

this happens

Binyamin
28 Aug, 2023, 12:34

Probably because it can't be the same name Change it to appwriteConfig.ts and the import and re test

Manikanta
28 Aug, 2023, 12:35

okay

Manikanta
28 Aug, 2023, 12:55

Changed it but same as above

Binyamin
28 Aug, 2023, 12:55

What error now?

Binyamin
28 Aug, 2023, 12:56

Ohh Yes,

Binyamin
28 Aug, 2023, 12:57

For <:vite:1007379819660595291> vite any files most be inside the src foler Move the appwriteConfig.ts into the src one And change the login to

TypeScript
import { account } from "../appwriteConfig";
Manikanta
28 Aug, 2023, 13:16

Thanks its working

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