Currently keycloak-js is shipped in the CommonJS Module format. [This post|https://web.dev/commonjs-larger-bundles] has a full explanation on how this format was designed for server-side systems (NodeJS) and how it does not support efficient tree shaking and bundle size reduction for use in front-end web applications. It also includes a link to a Rollup module for generating ESM (ECMAScript Module) bundles.
This article has more details on the ESM format and how imports work.
Currently using keycloak-js in an Angular version 10+ application gives the following build warning:
That link has a brief explanation on how to silence these warnings and links to the 2 articles above.
In order to allow applications using Keycloak on the front-end to be as efficient as possible (and best support the global community where 2G and 3G connections are common), keycloak-js should be published in ESM format.
This can be in addition to the existing CommonJS format.