I have a module like this:
module.exports = class Edge {
constructor(vertex1, vertex2) {
this.vertex1 = vertex1;
this.vertex2 = vertex2;
}
}
I want to import it into some NodeJS files and some front-end files in Chrome. I know Chrome now supports ES6 modules, but importing is giving me trouble:
ReferenceError: module is not defined
I think I'm supposed to use export class { ... }, but that's NOT supported in NodeJS right? How can I make this module work with both Chrome and NodeJS?