teamhanko / hanko

Authentication and user management system with passkey superpowers

Home Page:https://hanko.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Module '"@teamhanko/hanko-elements"' has no exported member 'Hanko'

ayushsgithub opened this issue · comments

Checklist

  • I could not find a solution in the existing issues or docs.
  • I agree to follow this project's Code of Conduct.

Describe the bug

It's giving error while importing Hanko from "@teamhanko/hanko-elements"

Screenshot 2023-10-10 113313

Reproducing the bug

Steps to reproduce the error:

  1. Create an app with next:latest
  2. Install hanko and configure it in the app from docs
  3. While configuring you'll notice errors in HankoAuth.tsx and Logout.tsx
  4. There's was an error in setting up the environment variable also
    Screenshot 2023-10-10 114042
  5. This can be gone by adding "!" at the end: const hankoApi = process.env.NEXT_PUBLIC_HANKO_API_URL!; as mentioned on stackoverflow

Logs

No response

Configuration

No response

Hanko Version

0.8.3

OS Hanko Backend

None

OS Version Hanko Backend

No response

OS

Windows

OS Version

No response

Browser Version

No response

Environment

None

Additional Context

No response

Please check here; Hanko is not showing up
Screenshot 2023-10-10 115515

Hi @ayushsgithub, thanks for reporting! We're aware of the issue and it most probably is due to the moduleResolution - bundler value introduced with Typescript 5 (which I guess new apps created with the next script use). There's also this PR which, if properly updated hopefully solves the issue.

commented
Could not find a declaration file for module '@teamhanko/hanko-frontend-sdk'. 'd:/Git/sbte-refactor/node_modules/@teamhanko/hanko-frontend-sdk/dist/sdk.modern.js' implicitly has an 'any' type.
  There are types at 'd:/Git/sbte-refactor/node_modules/@teamhanko/hanko-frontend-sdk/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@teamhanko/hanko-frontend-sdk' library may need to update its package.json or typings.ts(7016)

This is what it shows to me

Here's how to solve the issue according to #1076 pull request:

  1. Go to node_modules/@teamhanko/hanko-frontend-sdk/package.json
  2. replace line 15 and 16 where you have
    "require": "./dist/sdk.cjs", "default": "./dist/sdk.modern.js"
    with this:
    ".": { "require": "./dist/sdk.cjs", "types": "./dist/index.d.ts", "default": "./dist/sdk.modern.js" }
    Screenshot from 2023-10-11 00-19-24
    Screenshot from 2023-10-11 00-19-39
    @ayushsgithub @amjed-ali-k