Why is the following code gives me an error?
// In Foo.js
class Foo {
constructor(a) {
this.a = a;
}
}
module.exports = Foo
// In Index.js
var foo = new require('path/Foo.js')('param');
This gives me Class constructor Foo cannot be invoked without 'new'.
Thanks.
requirefunction withnewrather than your constructor?