Doesn't work with es6 classes declaration
Closed this issue · 3 comments
xfg commented
I try to use this library, but dm is die with es6 classes style.
Such description
module.exports = class {
constructor() {
//code
}
method() {
//code
}
}
throws error:
TypeError: Class constructor cannot be invoked without 'new'
at Factory.extend.newInstanceWithArgs (/home/user/project/node_modules/dm/lib/factory/constructor.js:30:39)
at Factory.extend.factory (/home/user/project/node_modules/dm/lib/factory/constructor.js:50:28)
at /home/user/project/node_modules/dm/lib/dm.js:586:32
at process._tickCallback (internal/process/next_tick.js:103:7)
at Function.Module.runMain (module.js:577:11)
at startup (node.js:160:18)
at node.js:449:3
gobwas commented
Hi @xfg!
Yeah, thats because in the default factory there is a code.
I think it will work fine with some code like this https://github.com/gobwas/dm.js/pull/48/files.
Could you review it, maybe I am missed something?