Skip to content

Issue with map-obj 5.0.2 being an ES module and @adzerk/management-sdk compiled to ES5 #75

@rlustemberg

Description

@rlustemberg

Hello,

I've encountered an issue while using the @adzerk/management-sdk library. It seems that this library is trying to use the map-obj version 5.0.2, which is an ES Module, but @adzerk/management-sdk is compiled to ES5 and uses CommonJS module syntax.

Here is the error message that I am getting:

Error [ERR_REQUIRE_ESM]: require() of ES Module /app/node_modules/map-obj/index.js from /app/node_modules/@adzerk/management-sdk/lib/propertyMapperFactory.js not supported.
Instead change the require of index.js in /app/node_modules/@adzerk/management-sdk/lib/propertyMapperFactory.js to a dynamic import() which is available in all CommonJS modules.

As you can see, the error message suggests using a dynamic import() instead of require(). But as @adzerk/management-sdk is transpiled to ES5, it is not compatible with ESM syntax.

Possible solutions could be:

  • Updating the @adzerk/management-sdk build process to output ES6 or later, which includes native import/export syntax.
  • Sticking with CommonJS, but adding a build step to transpile dependencies to CommonJS.
  • Using dynamic import() to load map-obj.

Could you please look into this issue?

Thanks for your help and let me know if you need any more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions