Search code examples
angulartypescriptkeycloak

Cannot find module 'keycloak-js/authz' while import with TypeScript


I get an error while importing KeycloakAuthorization from Keycloak 24 in TypeScript.

import KeycloakAuthorization from 'keycloak-js/authz';
// Causes: Cannot find module 'keycloak-js/authz' or its corresponding type declarations.

The export seems available. According to this this and this it should work.

moduleResolution is set to node in tsconfig.json

Steps to reproduce:

git clone https://github.com/fschick/Keycloak.ASPNet.Angular.git
cd Keycloak.ASPNet.Angular
switch main-fs-update
cd source\frontend\
npm install
npm run start

Does anyone know what is wrong and what I have to change or where do I have to open an issue (Keycloak, Angular, TypeScript, ...)?


Solution

  • moduleResolution has to be set to bundler in tsconfig.json