NAPI Config

NAPI Config

The config schema of NAPI-RS.

All the fields in napi is optional.


  napi?: {
    name?: string
    triples?: {
      defaults?: boolean,
      additional?: string[]
    package?: {
      name?: string
nameThe binary file name of generated .node file. Eg [NAME].[TRIPLE?].node
triples.defaultsWhether to enable the default triples.
The default triples is ['x86_64-apple-darwin', 'x86_64-unknown-linux-gnu', 'x86_64-pc-windows-msvc'].
The default value of triples.defaults is true
triples.additionalAdditional triples besides the default triples you want to build. Target triples could be found in the output of rustup target list command.
package.nameOverride the name field in package.json. See Build#js-package-name for usage.

What is target triple

See rustc/platform-support and LLVM/CrossCompilation

Targets are identified by their "target triple" which is the string to inform the compiler what kind of output that should be produced.

The triple has the general format <arch><sub>-<vendor>-<sys>-<abi>, where:

  • arch = x86_64, i386, arm, thumb, mips, etc.
  • sub = for ex. on ARM: v5, v6m, v7a, v7m, etc.
  • vendor = pc, apple, nvidia, ibm, etc.
  • sys = none, linux, win32, darwin, cuda, etc.
  • abi = eabi, gnu, android, macho, elf, etc.
Last updated on August 17, 2022