xataio / client-ts

Xata.io SDK for TypeScript and JavaScript
https://xata.io/docs/sdk/typescript/overview
Apache License 2.0
123 stars 8 forks source link

ambiguous indirect export: buildClient xata.ts:2:9 #823

Closed Exrun94 closed 1 year ago

Exrun94 commented 1 year ago

Hello there! It's my first time I wanted to try Xata and I have followed the instructions using the CLI to generate the xata.ts and I've been getting this error

Uncaught SyntaxError: ambiguous indirect export: buildClient [xata.ts:2:9](http://localhost:5173/src/xata.ts?t=1671370867641)

Repo to reproduce the issue

The repo is a boilerplate code I am creating for myself using Vite + React & Typescript

SferaDev commented 1 year ago

Hey @Exrun94 thanks for your report. I will investigate the error further tomorrow morning!

In any case, some early thoughts that can help us find a solution. I suspect it's related to plugin-react-swc, to check if my gut is right could you:

In any case, I'll try debug it and open an issue if needed to their repo as a library author.

Note: For vite, are you planning on using one of their SSR plugins and deploy it with a server? Or a client static site? For client apps you will see a security error as you will be exposing your database credentials to anyone inspecting your app in the browser.

Exrun94 commented 1 year ago

Thanks for the quick reply, I will give these suggestions a try and let you know

Exrun94 commented 1 year ago

Good call, I confirm upgrading plugin-react-swc to v3.0.1 has fixed the problem there!

And thank you for pointing out the security issues of exposing the API keys, I am aware of it already and thinking of what I want to do. The Xata Workers seems will do the trick Cheers

SferaDev commented 1 year ago

Could you reach out via support@xata.io so @kostasb can make the arrangements to flag you in the Xata Workers beta?

Exrun94 commented 1 year ago

Thank you, I've sent them an email! :)