AleksandrRogov / DynamicsWebApi

DynamicsWebApi is a Microsoft Dataverse Web API helper library for JavaScript & TypeScript
MIT License
268 stars 58 forks source link

DynamicsWebApi is not a constructor #166

Closed sya-sp closed 5 months ago

sya-sp commented 6 months ago

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):

AleksandrRogov commented 6 months ago

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

AleksandrRogov commented 5 months ago

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.