Adding package as a dependency in a typescript project


I’m currently trying to add bpmn-js as a dependency in a typescript library for customizing.

I can’t import the bpmn-navigated-viewer.production.min.js from the dist folder because it requires a window object, which is not available in node, and frankly not needed for extension purposes either.

if i try a default import like “import from ‘bpmn-js’” it complains that it cannot use an import statement outside of a module.

In addition to this, it would be great if typescript support could be added and maintained for the project. If required I can make the required contribution. Just need to know if you guys wanna maintain it in the repo or at DefinitelyTyped.


bpmn-js doesn’t work in a Node.js environment. You need a (headless) browser to run it.

@philippfromme The idea isn’t to run it tho. It is to bundle it inside a typescript app as dependency, extend it, and then rebundle it. I was having problems at the bundling part and then adding it as a local dependency to a vue project. I solved it with project references at first, but then shifted to npm link. This has although nothing to do with bpmnio in itself, i posted the question in case someone had a similar experience and could share how they achieved the same.

I’m thankful for the headless browser tip. I’m sure it will be helpfull down the line while writing tests for my extensions.