DynamicsWebApi icon indicating copy to clipboard operation
DynamicsWebApi copied to clipboard

DynamicsWebApi is not a constructor

Open sya-sp opened this issue 1 year ago • 1 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

sya-sp avatar Feb 16 '24 04:02 sya-sp

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 avatar Feb 17 '24 20:02 AleksandrRogov

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.

AleksandrRogov avatar Mar 31 '24 14:03 AleksandrRogov