When integrating keycloak-angular version 26 into your Angular application, you might encounter an issue where the library is unable to locate the keycloak-js module. This problem often arises due to the TypeScript module resolution strategy employed in your project.
Solution:
To resolve this issue, adjust the moduleResolution setting in your project's tsconfig.json file to "bundler". This configuration directs TypeScript to resolve modules in a manner compatible with modern bundlers, facilitating the correct identification of the keycloak-js module.
Steps to Implement:
Open tsconfig.json:
Locate the tsconfig.json file at the root of your Angular project.
Modify the compilerOptions:
Within the compilerOptions section, set the moduleResolution property to "bundler":
{
"compilerOptions": {
// ... other configurations ...
"moduleResolution": "bundler"
}
}
Save and Rebuild:
After saving the changes, rebuild your project to apply the new configuration.