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

Better relative paths #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lightsofapollo
Copy link

Thanks for this great work ! This was the part I couldn't figure out . As it was though this didn't seem to produce paths webpack could resolve. I used some tricks with pkgUp to output better relative paths (node-kafka/build/Release/foo.node vs ./foo.node.js)

@lightsofapollo lightsofapollo mentioned this pull request Feb 6, 2019
@simonbuchan
Copy link
Owner

Sorry for the late reply, I don't seem to be getting notifications for my own repositories 🤨.

Hmm, I'm a little confused by this: addonRequest is supposed to be the emitted request path, as in, relative to the emitted output .js. That is, when node-kafka's bindings usage resolves to .../node-kafka/build/Release/foo.node, this is supposed to emit into your dist/main.js the JS require('./foo.node'), and the output file dist/foo.node.

Now webpack sees require("foo.node") and then you can either use some .node loading method you like, or just leave them as externals like in the example in README.md. Does this make the problem you were having make sense? It's fair enough to be confused, given how raw this package is 😇

I have some changes I could make here to make this less confusing, especially the variable names, and really you should have the option to control the output request name. I've recently started switching by native packages over to N-API and node-prebuildify, which doesn't work with bindings, so I might put some of the loader code I've used with that out. That said, it's no longer a bindings loader, so...

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.

2 participants