You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor requireNodeAddon to take the package name and extension-less path of an addon #222
This is the friendly resolver, layered on top of the raw dlopen API in #498, which is a prerequisite. It stays in this project rather than moving into React Native core. Resolving { packageName, path } at runtime likely needs #497.
This is a suggestion which is subtly different from the one proposed in #91.
Goals
Removing the requirement for the Babel plugin, for use-cases where a library author "controls" the code calling into the host package.
Give more control to the host package when deciding what library files to loads (at runtime).
Supporting multiple platforms (including Node.js) with source-code calling into the host package with the same call arguments
Imagine a library ("my-lib") with a single index.js entrypoint calling into our host package:
// node_modules/my-lib/index.js
import { requireNodeAddon } from "react-native-node-api";
const addon = requireNodeAddon({
packageName: "my-lib", // The name from the package.json
path: "build/Release/hello" // Path to the addon, relative to the package root, stripped from its ".*.node" file extensions.
});
export const sum = addon.sum;
Activity