cytoscape / cytoscape.js-dagre

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

Requires windows since 2.3.1 #62

Closed physikerwelt closed 3 years ago

physikerwelt commented 3 years ago

While upgrading from 2.2.1 to 2.3.1 I realized that this line

const dagre = require('cytoscape-dagre');

does no longer work in an headless node environment. My workaround was

if (typeof (window) !== 'undefined') {
  const dagre = require('cytoscape-dagre');
  cytoscape.use(dagre);
}
maxkfranz commented 3 years ago

@harryadel, it looks like your PR is responsible for this issue. Could you investigate?

https://github.com/cytoscape/cytoscape.js-dagre/pull/58

harryadel commented 3 years ago

@maxkfranz I'm a bit limited on time but I'll look into it this weekend if it's ok with you.

maxkfranz commented 3 years ago

OK

On Nov 17, 2020, at 16:22, Harry Adel notifications@github.com wrote:

 @maxkfranz I'm a bit limited on time but I'll look into it this weekend if it's ok with you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

harryadel commented 3 years ago

@physikerwelt Could you please provide a sample of the headless environment you're testing with?

maxkfranz commented 3 years ago

It looks like the webpack upgrades create a reference to window instead of this:

Before:

https://github.com/cytoscape/cytoscape.js-dagre/blob/eaddff2e401d0e1e8a9f85158d4068d70a48e88f/cytoscape-dagre.js#L10

After:

https://github.com/cytoscape/cytoscape.js-dagre/blob/c18078fca8bfa2b682cf2c6c994d63667e081d2c/cytoscape-dagre.js#L10

@harryadel, could you look into this webpack config issue? Maybe output.globalObject?

maxkfranz commented 3 years ago

It looks like this may have been addressed in #63 by @N8th8n8el re. another issue.

@harryadel & @physikerwelt, could you test and confirm that this resolves your issue?

maxkfranz commented 3 years ago

@harryadel, @physikerwelt, have you had a chance to investigate whether #63 resolves your issue?

physikerwelt commented 3 years ago

sorry, not yet.