AleksandrRogov / DynamicsWebApi

DynamicsWebApi is a Microsoft Dataverse Web API helper library for JavaScript & TypeScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DynamicsWebApi is not a constructor

sya-sp opened this issue · comments

DynamicsWebApi version
v2.1.1

Describe the bug
Not able to initialize constructor

Actual result
DynamicsWebApi is not a constructor

Code Snippet

var DynamicsWebApi = require("dynamics-web-api")
var dynamicsWebApi = new DynamicsWebApi();

Steps To Reproduce
https://runkit.com/embed/dlxpjx6nnivz

Your Setup (please complete the following information):

  • Node v20.11.0
  • Dynamics 365 Online

hi @sya-sp ,
I will need to figure out why this happens, looks like I may be missing some configuration in esbuild during compilation process. Need to dive into some CommonJS concepts. Please, for a CommonJS module use the following for now:

var DynamicsWebApi = require("dynamics-web-api").DynamicsWebApi;

var dynamicsWebApi = new DynamicsWebApi();

Thank you

I decided not to change this behavior, even though there are ways to achieve a single export. The main reasoning is: I don't want to introduce a breaking change. Though I may change my mind in the future :).

Thank you for reporting this.