https://supertokens.com/ logo
#support-questions
import error
# support-questions
p

PATETO

05/03/2023, 4:01 PM
Hello, Why can't I import the ui in react
Copy code
import { getSuperTokensRoutesForReactRouterDom } from "supertokens-auth-react"
It tells me that it can't find a module with that name. Framework : React Vitejs Typescript Additional information: without vitejs, using create-react-app everything works perfectly.
r

rp

05/03/2023, 4:54 PM
hey @PATETO the sdk you are using is the latest one. We will be updating our docs today to reflect the new API. Stay tuned.
p

PATETO

05/03/2023, 5:00 PM
@rp Thank you so much !
r

rp

05/03/2023, 5:06 PM
we just released the new docs. Empty cache and Hard reload the page. If it doesn't show the new import statement, change the
supertokens.com
domain to
test.supertokens.com
and see the content there 🙂
p

PATETO

05/03/2023, 7:30 PM
@rp I just tested with the new import: ``import { getSuperTokensRoutesForReactRouterDom } from "supertokens-auth-react/ui";`` and the problem persists. Error message in VSCode:
Copy code
Module '"supertokens-auth-react/ui"' has no exported member 'getSuperTokensRoutesForReactRouterDom'. Did you mean to use 'import getSuperTokensRoutesForReactRouterDom from "supertokens-auth-react/ui"' instead?
Additional information : I have the impression that probably Vitejs can't import some SuperToken module? Because I created a blank project with Vitejs and I still have the same problem.
r

rp

05/03/2023, 7:52 PM
Which version of the SDK are you using?
Maybe you can open an issue about this on our GitHub. We will check it out asap
p

PATETO

05/03/2023, 11:03 PM
Je suis désolé, c'est sûrement moi qui utilise mal SuperTokens, après avoir utiliser la nouvelle syntaxe d'import, cela marchait mais TypeScript m'affiche toujours la même erreur, j'ai pas réussi à l'enlever. Ce qui me pose aussi un problème maintenant, c'est de l'utilisation avec ``createBrowserRouter`` je n'arrive pas à le faire marcher. Je ne peut pas utiliser ``createBrowserRouter`` ? Doit-je obligatoirement utiliser la ```` comme dans la documentation? J'ai vu cette discussion, mais je ne sais pas comment l'implémenter https://stackoverflow.com/a/74510386

https://cdn.discordapp.com/attachments/1103350642623389756/1103456879998410842/Capture_decran_2023-05-03_a_21.10.50.png

Update that work : My source : https://cloud.tencent.com/developer/ask/sof/107461868 On the other hand, why typescript does not find ``getSuperTokensRoutesForReactRouterDom`` and tell me:
Copy code
Module '"supertokens-auth-react/ui"' has no exported member 'getSuperTokensRoutesForReactRouterDom'. Did you mean to use 'import getSuperTokensRoutesForReactRouterDom from "supertokens-auth-react/ui"' instead?
r

rp

05/04/2023, 5:41 AM
which version of the supertokens-auth-react sdk are you using?
p

PATETO

05/04/2023, 12:54 PM
In my package.json ``"supertokens-auth-react": "^0.32.0"``
r

rp

05/04/2023, 12:55 PM
right. So the import should work..
try importing from
supertokens-auth-react/ui/index
?
p

PATETO

05/04/2023, 1:17 PM
Same error
Maybe it's my tsconfig? Or vite.config?
Yes when I added ``/ui`` It worked but I have a typescript error on my editor only, so I did a // @ts-ignore To ignore the typescript error I was just wondering why typescript fails to import properly
But on browser it works fine
r

rp

05/04/2023, 1:25 PM
im not sure. Does using tsc on CLI give the same error?
cause it might just be an editor issue and not actually a TS issue
p

PATETO

05/04/2023, 2:04 PM
I have the same error using tcs command
r

rp

05/04/2023, 2:05 PM
Oh! Oil you please open an issue about this?
On our GitHub
p

PATETO

05/04/2023, 2:07 PM
okey I'll do it
r

rp

05/04/2023, 2:22 PM
thanks
p

PATETO

05/04/2023, 2:53 PM
I just did it Thank for you, for listening
r

rp

05/04/2023, 2:53 PM
great! thanks for opening the issue. We will see what's happening
10 Views