There is another question just like that: Using dc.js with node.js
But the example in the answer uses dc.js on the client side. I want to use it in the server side.
I created a .js file and I put this line:
const dc = require('dc');
When I execute the file I get this error:
/home/fagner/projects/node-test/node_modules/dc/dc.js:475 if (!Element.prototype.matches) { ^
ReferenceError: Element is not defined at _dc (/home/fagner/projects/node-test/node_modules/dc/dc.js:475:1) at /home/fagner/projects/node-test/node_modules/dc/dc.js:13649:26 at Object. (/home/fagner/projects/node-test/node_modules/dc/dc.js:13654:2) at Module._compile (internal/modules/cjs/loader.js:701:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12) at Function.Module._load (internal/modules/cjs/loader.js:531:3) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18)
What am I missing?
There are many questions related to this on StackOverflow, but it seems that everyone can import dc.js without any problem. Do I need to install any other dependency?
I know that Element is not recognized by the server, so how can I mock it using domino?