This commit is contained in:
Jay 2020-08-25 16:47:12 +08:00
parent fa3715c748
commit 657d47722f
4 changed files with 7 additions and 6 deletions

View File

@ -1,10 +1,11 @@
const path = require('path')
const { loadBinding } = require('@node-rs/helper')
try {
// __dirname means load native addon from current dir
// 'index' means native addon name is `index`
// the value of this two arguments was decided by `build` script in `package.json`
module.exports = loadBinding(__dirname, 'index')
module.exports = loadBinding(path.join(__dirname, '..', `rs-diff-${process.platform}`), 'index')
} catch (e) {
try {
module.exports = require(`@swc-node/core-${platform()}`)

View File

@ -1,6 +1,6 @@
{
"name": "rs-diff-darwin",
"version": "0.0.1",
"version": "0.0.2",
"description": "Template project for writing node package with napi-rs",
"repository": "https://git.trj.tw/nodejs/rs-diff.git",
"license": "MIT",

View File

@ -1,6 +1,6 @@
{
"name": "rs-diff-linux",
"version": "0.0.1",
"version": "0.0.2",
"description": "Template project for writing node package with napi-rs",
"repository": "https://git.trj.tw/nodejs/rs-diff.git",
"license": "MIT",

View File

@ -1,6 +1,6 @@
{
"name": "rs-diff",
"version": "0.0.1",
"version": "0.0.2",
"description": "Template project for writing node package with napi-rs",
"author": "Jay <jay@trj.tw>",
"main": "index.js",
@ -58,7 +58,7 @@
}
},
"optionalDependencies": {
"rs-diff-darwin": "^0.0.1",
"rs-diff-linux": "^0.0.1"
"rs-diff-darwin": "^0.0.2",
"rs-diff-linux": "^0.0.2"
}
}