cytoscape / cytoscape.js-dagre

The Dagre layout for DAGs and trees for Cytoscape.js
MIT License
249 stars 83 forks source link

Can not apply layout: No such layoutdagrefound; did you include its JS file? #22

Closed maxkfranz closed 7 years ago

maxkfranz commented 7 years ago

Ref: https://github.com/cytoscape/cytoscape.js/issues/1738


I get this error when I'm trying to use the dagre layout

Can not apply layout: No such layoutdagrefound; did you include its JS file?

import cytoscape from 'cytoscape'
import cydagre from 'cytoscape-dagre'
cydagre( cytoscape )

...
    var cy = cytoscape({
      container: document.getElementById('cy'),
      elements:{ nodes:graph.nodes, edges: graph.edges},
      layout: {
        name: 'dagre',
      },
    })

If I use the default layouts works fine.

maxkfranz commented 7 years ago

@mj3cheun Would you please look into this when you're doing your Webpack testing?

bernatfortet commented 7 years ago

thanks for switching threads @maxkfranz

mj3cheun commented 7 years ago

Found the issue, the problem is webpack defaults to AMD over CommonJS, which requires all the dependencies (Dagre) to be passed in manually.

This issue is fixed in commit 7d26a2137184719232dd4842c5dcfe8827d84290 and will be published soon.

luli-isa commented 7 years ago

When the commit will be publish ? I have the same error on my react project with webpack.

maxkfranz commented 7 years ago

@mj3cheun is working on that now. It will be published in the next day or so. You can use a git url ref in your package.json in the meanwhile to use the latest code from master

mj3cheun commented 7 years ago

Has been published. Use latest version 1.5.0.