Skip to content

[napi] Macro compiles & expands but doesn't register exports #2048

@aaronclong

Description

@aaronclong

I'm kind of losing my mind over this, but I can't figure out a function and struct annotated with [napi] failed to get registered in the nodejs module. I've tried hundred iterations but nothing works. Admittedly, I am extremely weak at Rust programming, and can be making several mistakes. You can see the code here: https://github.com/turingscript/tokenizers/blob/8ee1e65e5cb190f3e451865d29d807d120b5b072/bindings/node/src/bpe_trainers.rs

image

The PR is located here but contains various changes as well. https://github.com/turingscript/tokenizers/pull/6/files

I'm testing this by compiling and packing my build. I then install it locally in a dummy project using npm install ${locall file path...}.

In the advent the component can't be exported, I would expect the build to fail or at least give a warning in the logs.

In addition, the documentation is very sparse and lacking some critical info and examples. I can seem to find a single section that would help me debug this.

I would appreciate any help in debugging this, and in addition would like to encourage any improvements to create better feedback on this error and it's route cause. I imagine a compiler plugin or something of the sort could greatly help here.

#1214 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions