dagre icon indicating copy to clipboard operation
dagre copied to clipboard

Importing dagre.js after traspiling with Babel

Open vakokako opened this issue 5 months ago • 1 comments

Hi, I want to preface this by saying that we are not knowledgeable with javascript importing, but would be grateful if you can help us with our problem :)

We want to use dagre in application that uses Qml for UI. Qml runtime allows to import javascript files to use in Qml, but only supports Ecmascript version 7. Our solution was to use Babel to transpile the dagre.js to ES7, then Qml engine seems to parse the dagre.js correctly without complaints. However, after importing dagre.js, we can't access the exported variables, like dagre.graphlib.

Are there any reasons that this should not work, if Qml engine implements ES7. Maybe dagre.js is only supposed to work in browsers? Or some other checks during import fail... Would be super helpful to hear some input on this.

I'm also attaching the transpiled dagre.js. dagre.es7.zip

vakokako avatar Aug 30 '24 14:08 vakokako