Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nearby resolution #27

Merged
merged 1 commit into from
Nov 3, 2019
Merged

Add nearby resolution #27

merged 1 commit into from
Nov 3, 2019

Conversation

emilbayes
Copy link
Contributor

This specifically allows loading of native modules with zeit/pkg

@mafintosh mafintosh merged commit f3f0e2f into master Nov 3, 2019
@mafintosh mafintosh deleted the load-nearby branch November 3, 2019 21:02
@mafintosh
Copy link
Collaborator

4.2.0

if (prebuild) return prebuild

var nearby = resolve(path.dirname(process.execPath))
if (nearby) return nearby
Copy link
Member

Choose a reason for hiding this comment

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

What happens if you have multiple addons using node-gyp-build? Won't they conflict?

Copy link
Member

Choose a reason for hiding this comment

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

And what happens in a packed Electron app (e.g. with electron-builder)? Which doesn't have a "real" execPath IIRC.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don’t think this is relevant for electron but yes we should namespace the location here. This was a quick fix to work around a cli bundling issue

Copy link
Member

Choose a reason for hiding this comment

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

@mafintosh Is there a relevant GH issue I can read to learn more?

And re: electron, I'm a bit worried that this will accidentally load e.g. /tmp/foo.node.

Copy link
Collaborator

Choose a reason for hiding this comment

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

No issue sorry, we were debugging together. Can you explain the last part? About loading foo.node

Copy link
Member

Choose a reason for hiding this comment

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

I vaguely recall that process.execPath is a temporary location in some cases, but I can't find documentation on that just now. Maybe I'll try to test it later this week.

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

Successfully merging this pull request may close these issues.

3 participants