Uploaded image for project: 'Red Hat Internal Developer Platform'
  1. Red Hat Internal Developer Platform
  2. RHIDP-3542

Spike: Proof of concept of Dynamic Import of ESM modules in CJS

    • Icon: Task Task
    • Resolution: Done
    • Icon: Undefined Undefined
    • 1.4.0
    • None
    • Core platform
    • None
    • 5
    • False
    • Hide

      None

      Show
      None
    • False
    • RHDH Core Team 3261, RHDH Core Team 3262, RHDH Core Team 3263

      It's worth exploring whether we can use Dynamic Imports to import the Keycloak module. This would save us having to build a wrapper.

      Useful reading - https://nodejs.org/api/esm.html#interoperability-with-commonjs

      A suggestion might be to create a asynchronous loadKeycloakModules() function that is called in this style:

      {{async function loadKeycloakModules() { }}

      {{const

      { default: KcAdminClient }

      = await import('@keycloak/keycloak-admin-client');}}

      The ideal outcome of the task would be a draft PR to https://github.com/janus-idp/backstage-plugins that uses this method of loading.

      It may be easiest to start with updating to @keycloak/keycloak-admin-client@19.0.3 to test the ESM interoperability without having to account for the breaking changes between 18 and 25 (the latest major version).

              mittkash Kashish Mittal
              bgriggs@redhat.com Bethany Griggs
              RHIDP - Cope
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: