I tried running this in node directly, the first call returns the global object (which presumably was partially bound as a ResolverFactory because that's what this was when running the constructor as a function).
and subsequent calls fail because the rust code is not happy constructing onto an object twice.
> ResolverFactory({ conditionNames: ["node","require"] })
Uncaught:
[Error: Failed to initialize class `constructor`] { code: 'InvalidArg' }
The example should be corrected to be new ResolverFactory(...)? The rust code could also maybe do a better job of determining whether the ResolverFactory was called as a method or constructor.
The README example code under "Cache", reads
I tried running this in node directly, the first call returns the global object (which presumably was partially bound as a ResolverFactory because that's what
this
was when running the constructor as a function).and subsequent calls fail because the rust code is not happy constructing onto an object twice.
The example should be corrected to be
new ResolverFactory(...)
? The rust code could also maybe do a better job of determining whether theResolverFactory
was called as a method or constructor.