Or do
module.exports = class MyClass { constructor(arg){ console.log(arg); } };
and import using
var a = require("./class.js"); new a("fooBar");
or use the new syntax (you may need to update your code first)
export class MyClass { constructor(arg){ console.log(arg); } };
and import using
import {myClass} from "./class.js";
source share