Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Respect conditions if present #8

Closed
wants to merge 2 commits into from

Conversation

vpzomtrrfrt
Copy link

See also jestjs/jest#11859

There's probably a better way to do this, but this works for my use case at least. Should fix #5

index.js Outdated Show resolved Hide resolved
@k-g-a k-g-a requested a review from piranna January 9, 2022 11:24
|| key2 === "require"
|| key2 === "node-addons"
|| key2 === "default") {
if(conditions.indexOf(key) !== -1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use includes() here.

|| key2 === "require"
|| key2 === "node"
|| key2 === "default") {
if(conditions.indexOf(key) !== -1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use includes() here.

@@ -202,8 +200,7 @@ module.exports = (request, options) => {
targetFilePath = value;
else
for(const [key2, value2] of Object.entries(value))
if(key2 === "import"
|| key2 === "require"
if(conditions.indexOf(key2) !== -1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use includes() here. Also, it should not check for default again, it's an error.

@piranna
Copy link
Collaborator

piranna commented Jan 13, 2022

Hi @vpzomtrrfrt, your changes inspired me to how to aproach the problem and I think I've fixed it at 900da2e, now conditions are properly enforced and work in (one of) my use cases. Can you update to version 1.1.3 and confirm that it works for you too? If not, please update your PR and I'll merge it :-)

@vpzomtrrfrt
Copy link
Author

Yes, the latest release appears to work

@piranna
Copy link
Collaborator

piranna commented Jan 15, 2022

Yes, the latest release appears to work

Great, good to know :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doesn't work with ws module
2 participants