Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: BpmnModdle is not a constructor #18

Closed
jackzhujie opened this issue Aug 4, 2020 · 11 comments
Closed

TypeError: BpmnModdle is not a constructor #18

jackzhujie opened this issue Aug 4, 2020 · 11 comments
Labels
bug Something isn't working pr welcome We rely on a community contribution to improve this.

Comments

@jackzhujie
Copy link

jackzhujie commented Aug 4, 2020

Describe the Bug

In our environment, after I used the bpmnModeler.connect() method to connect a line, I needed to automatically layout it, and I got an error:
BpmnModdle is not a constructor

Steps to Reproduce

Example Code snippet

const {xml} = await this.bpmnModeler.saveXML({format: true});
const autoLayout = new AutoLayout();
let layOutXml = await autoLayout(xml);`

Example CodeSandbox

Expected Behavior

Should not crash.

@jackzhujie jackzhujie added the bug Something isn't working label Aug 4, 2020
@pinussilvestrus
Copy link
Contributor

For further assistance, please share a CodeSandbox that reproduces your issue in a way that we can inspect it.

@pinussilvestrus pinussilvestrus added help wanted Extra attention is needed and removed bug Something isn't working labels Aug 4, 2020
@jackzhujie
Copy link
Author

code

@pinussilvestrus
Copy link
Contributor

Thanks for sharing! Looks like an incompatibility with the latest bpmn-moddle version. We're open for a contribution which solves this issue 👍

@pinussilvestrus pinussilvestrus added bug Something isn't working backlog Queued in backlog and removed help wanted Extra attention is needed labels Aug 5, 2020
@pinussilvestrus
Copy link
Contributor

Hint: the AutoLayout module should be updated to use the correct import statement for the BpmnModdle module.

var BpmnModdle = require('bpmn-moddle').default;

@jackzhujie
Copy link
Author

Hint: the AutoLayout module should be updated to use the correct import statement for the BpmnModdle module.

var BpmnModdle = require('bpmn-moddle').default;

ok,thanks

@giero
Copy link

giero commented Nov 13, 2020

Or switch to ES Modules syntax:

import BpmnModdle from 'bpmn-moddle';
import Tree from './Tree';
import DiFactory from './DiFactory';

import DiUtil from './DiUtil';

and then

export default AutoLayout;

This worked for me :) (got the sma bug btw)

@nikku nikku added the pr welcome We rely on a community contribution to improve this. label Nov 13, 2020
@nikku
Copy link
Member

nikku commented Nov 13, 2020

We are open to contributions that fix this.

@matiasah
Copy link

Hint: the AutoLayout module should be updated to use the correct import statement for the BpmnModdle module.

var BpmnModdle = require('bpmn-moddle').default;

Would this definetly fix this issue? I'm also having this problem but I haven't tried this solution, I would open a PR with this if you confirm it works.

@nikku
Copy link
Member

nikku commented Jan 12, 2021

Would this definetly fix this issue?

You open the PR and find out 😄

@nikku nikku closed this as completed Jan 12, 2021
@bpmn-io-tasks bpmn-io-tasks bot removed the backlog Queued in backlog label Jan 12, 2021
@matiasah matiasah mentioned this issue Jan 13, 2021
@bpmn-io-tasks bpmn-io-tasks bot reopened this Jan 13, 2021
@matiasah
Copy link

Or switch to ES Modules syntax:

import BpmnModdle from 'bpmn-moddle';
import Tree from './Tree';
import DiFactory from './DiFactory';

import DiUtil from './DiUtil';

and then

export default AutoLayout;

This worked for me :) (got the sma bug btw)

I guess I'm going to try this instead

@nikku
Copy link
Member

nikku commented Jan 13, 2021

Closing this issue as we do not plan to follow up on this one, unless we receive an external contribution (pr-needed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pr welcome We rely on a community contribution to improve this.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants