-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing Keycloak breaks typescript in esModule #24923
Comments
Thanks to @ernestostifano |
You should not be importing Keycloak JS from a sub-path, that will likely break in the future. You should only import it from Please also provide a minimal reproducible example with actual code, as I am unable to reproduce your issue. An example on StackBlitz or a GitHub repo with minimal code will suffice. |
Yeah my bad, I should have update the import, it was one of my tests to find a solution. Unfortunately, even if typescript does not complain anymore I still get:
when I run the application |
Again, please provide a minimal and reproducible example. We cannot fix bugs we cannot reproduce. |
UPDATE:@jonkoops I created a patch of your package following this comment: Doubling the declaration files (just duplicated the file and renamed it to
|
Thanks for the reproduction, this helps a lot! Looking at your proposed solution, I agree that is likely the best option to add an |
Upon closer inspection, we still need the UMD build to statically serve Keycloak JS. This should be deprecated and removed, but now is not the time to do so. I'll create a fix that maintains the compatibility. |
Closes keycloak#24923 Signed-off-by: Jon Koops <jonkoops@gmail.com>
Closes keycloak#24923 Signed-off-by: Jon Koops <jonkoops@gmail.com>
Closes keycloak#24923 Signed-off-by: Jon Koops <jonkoops@gmail.com>
Closes keycloak#24923 Signed-off-by: Jon Koops <jonkoops@gmail.com>
Closes keycloak#24923 Signed-off-by: Jon Koops <jonkoops@gmail.com>
Closes keycloak#24923 Signed-off-by: Jon Koops <jonkoops@gmail.com>
Closes keycloak#24923 Signed-off-by: Jon Koops <jonkoops@gmail.com>
Hi @jonkoops thanks for the quick fix! It will be available in the 24.0.0 or is already available in the 23.0.0 just released? |
Since it is a breaking change it will be made available for v24, unfortunately it was too late to land this in v23. |
Closes keycloak#24923 Signed-off-by: Jon Koops <jonkoops@gmail.com>
Closes keycloak#24923 Signed-off-by: Jon Koops <jonkoops@gmail.com> Signed-off-by: Kamontat Chantrachirathumrong <14089557+kamontat@users.noreply.github.com>
Closes keycloak#24923 Signed-off-by: Jon Koops <jonkoops@gmail.com> Signed-off-by: ShefeeqPM <86718986+ShefeeqPM@users.noreply.github.com>
Before reporting an issue
Area
adapter/javascript
Describe the bug
I have a monorepo, using Yarn 4 PnP and TS 5.2.2, migrating to ESM only.
I have already the Keycloak setup working like this:
when I change the type in the
package.json
fromcommonjs
tomodule
typescript complains about the usage of Keycloak with the following error:I tried changing the import to
import * as Keycloak from 'keycloak-js';
,import Keycloak from 'keycloak-js';
or even casting the type but it still gives me this error.Version
22.0.5
Expected behavior
I expected to work as when
commonjs
is set as typeActual behavior
Typescript complains about the imported Keycloak usage
How to Reproduce?
Use this repro
Anything else?
No response
The text was updated successfully, but these errors were encountered: