k-g-a / jest-node-exports-resolver

MIT License
25 stars 7 forks source link

Doesn't work with `ws` module #5

Open piranna opened 3 years ago

piranna commented 3 years ago

When importing ws module, it gets the CommonJS version instead of the ESM one, although it has defined both main and exports fields. This last one has conditions for both import and require, in case is this the issue.

vpzomtrrfrt commented 2 years ago

Looks like the current behaviour just picks the first one from import or require. Probably needs to somehow determine which one should be used

vpzomtrrfrt commented 2 years ago

ah, since Jest 27.2.0 it should be passing a conditions array to the resolver that could be used for this

piranna commented 2 years ago

ah, since Jest 27.2.0 it should be passing a conditions array to the resolver that could be used for this

Yes, but it's not fully implemented, I still have my PR open to add support by default for the browser and node conditions.