cytoscape / cytoscape.js-elk

The ELK layout algorithm adapter for Cytoscape.js
MIT License
43 stars 27 forks source link

ERROR: Could not resolve "web-worker" #48

Open vincerubinetti opened 2 weeks ago

vincerubinetti commented 2 weeks ago

Getting this error trying to use this package with a modern Vite SPA with ESBuild:

✘ [ERROR] Could not resolve "web-worker"

    node_modules/elkjs/lib/main.js:38:29:
      38 │         var Worker = require('web-worker');
         ╵                              ~~~~~~~~~~~~

  You can mark the path "web-worker" as external to exclude it from the bundle, which will remove
  this error and leave the unresolved path in the bundle. You can also surround this "require" call
  with a try/catch block to handle this failure at run-time instead of bundle-time.

/Users/vincerubinetti/Desktop/molevolvr2.0/frontend/node_modules/esbuild/lib/main.js:1472
  let error = new Error(text);
              ^

Error: Build failed with 1 error:
node_modules/elkjs/lib/main.js:38:29: ERROR: Could not resolve "web-worker"
    at failureErrorWithLog (/Users/vincerubinetti/Desktop/molevolvr2.0/frontend/node_modules/esbuild/lib/main.js:1472:15)
    at /Users/vincerubinetti/Desktop/molevolvr2.0/frontend/node_modules/esbuild/lib/main.js:945:25
    at /Users/vincerubinetti/Desktop/molevolvr2.0/frontend/node_modules/esbuild/lib/main.js:1353:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Node.js v22.5.0
error: script "dev" exited with code 1
stale[bot] commented 11 hours ago

This issue has been automatically marked as stale, because it has not had activity within the past 14 days. It will be closed if no further activity occurs within the next 7 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.