bpmn-io / bpmn-auto-layout

Layout BPMN diagrams, generating missing DI information.
50 stars 40 forks source link

Fix: TypeError: BpmnModdle is not a constructor (at work with es modules) #31

Closed corocoto closed 1 year ago

corocoto commented 1 year ago

Description

I met with this error again, when using es modules. To fix this problem, I decided to use 'OR' condition to get truly BpmnModdle class for both available types (commonjs, es modules). I believe that this PR fully closes and resolves the BpmnModdle is not a constructor error.

Related PRs:

Related issues:

nikku commented 1 year ago

I met with this error again, when using es modules. To fix this problem, I decided to use 'OR' condition to get truly BpmnModdle class for both available types (commonjs, es modules). I believe that this PR fully closes and resolves the BpmnModdle is not a constructor error.

How do you try to consume this library?

I think we want to settle on a library target (is this ES or CJS modules), clean this up, and potentially provide a pre-built distribution for it (that works independent of the usage context).

You'll likely run into troubles otherwise, depending how you include things.

corocoto commented 1 year ago

How do you try to consume this library?

I transform input JSON data, received from the backend side, to the BPMN object. After the previous step, I continue to construct the BPMN structure by adding DI elements and their own positions and sizes. In the end, I display the result on the page.

corocoto commented 1 year ago

I think we want to settle on a library target (is this ES or CJS modules), clean this up, and potentially provide a pre-built distribution for it (that works independent of the usage context).

You'll likely run into troubles otherwise, depending how you include things.

Hm, you're right, @nikku. I think it's the correct view of things. So, after our discussion, I decided to close this PR, because it became irrelevant.

nikku commented 1 year ago

https://github.com/bpmn-io/bpmn-auto-layout/pull/31#issuecomment-1490069293

From ES or CJS context? In the browser or in NodeJS?

corocoto commented 1 year ago

@nikku, from ES context (in the browser environment)

nikku commented 1 year ago

@corocoto Unfortunately we were not able to follow up on this PR on time. We'll close this for the time being and hope that we can revive this project some time in the future.