Module '"@teamhanko/hanko-elements"' has no exported member 'Hanko'
ayushsgithub opened this issue · 4 comments
ayushsgithub commented
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"
Reproducing the bug
Steps to reproduce the error:
- Create an app with next:latest
- Install hanko and configure it in the app from docs
- While configuring you'll notice errors in HankoAuth.tsx and Logout.tsx
- There's was an error in setting up the environment variable also
- 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
ayushsgithub commented
lfleischmann commented
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.
amjed-ali-k 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
akins-dev commented
Here's how to solve the issue according to #1076 pull request:
- Go to
node_modules/@teamhanko/hanko-frontend-sdk/package.json
- 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" }
@ayushsgithub @amjed-ali-k